Lens hoods protect your photos from glares and flares. These issues are caused by light hitting the lens at strange angles and bouncing around inside the lens rather than going through it to the image capturing surface (film or sensor).
Hoods will generally screw onto the front of your lens in the same place you’d attach a filter or lens cap. Some will attach with other mechanisms, but it’s important to get a hood with the same diameter as the front of your lens. Often lenses are labeled with the diameter symbol (⌀) to signify what size filters are needed.