A lens hood is a more versatile piece of kit than you might first think. Not only can it be used for blocking out harsh, flare causing rays from your shot, they can also be used for a few more things:
Sunlight - As mentioned above, a lens hood's main objective, and the purpose it was originally designed for, is to stop harsh glare from the sun getting into the lens and potentially ruining your shot. Having the sun directly to the side or above your camera will help to eliminate the amount of flare entering the lens, too.
Rain - If you're brave enough to head out and shoot in the rain (with your camera appropriately protected of course) a lens hood can come in handy here too. It can be used to shield the end of the lens from rain, much like a person wearing a baseball cap, to try and minimise the amount of drips that land directly on the lens and cause unsightly blurs on the finished photo. It's not something that's recommended in a huge downpour, though!
Glass Flare - Much like the lens hood stops harsh flare from the sun showing up in shots, it can also stop flare from glass spoiling the shot too. This issue is especially prominent in zoos where animals can potentially be behind glass screens. Reflections can encroach on the photo and make it obvious that the shot was taken through glass. To minimise the chances of this happening, fit a lens hood and hold the camera close to the glass to cut out reflections from the surrounding area.
Reflections - Water reflections causing glare to bounce back into the lens can be an issue when shooting in open or choppy water. The lens hood will help to stop the reflected glare from bouncing back into the lens, enabling you to get glare free shots.
Lens hoods are available in different shapes. The image above shows a bayonet lens hood, which is designed to minimise stray light and reduces lens flare and you can also get 'solid' lens hoods. Nikon sells a range of lens hoods in different lengths and designs.