Q: I bought a new Canon 24-70mm L lens. It just arrived and I noticed it has a lens hood included. I was wondering...do you usually leave that attached to your lens or do you seldom use it?
A: A lens hood serves two purposes: First, it prevents side light from hitting the front lens element (which causes lens flare & reduces contrast in the image). Second, it helps protect the lens from damage.
Prime lenses are less susceptible to lens flare than zoom lenses. Of all the lenses in my collection, the 24-70L is the most susceptible to lens flare. Sometimes that's a good thing. If I want to produce an image with lens flare (popular in portrait photography these days), I'll choose the 24-70 instead of my 85mm prime. Ironically, my 24-70 is the only lens for which I don't have a lens hood! And, when I'm using the 24-70mm and I don't want lens flare I find myself improvising by shading the lens with my hand, a hat, etc. Not terribly convenient (or professional).
For more information on lens flare check out this article: Understanding Camera Lens Flare
Honesty, I probably use my lens hoods more for protection than to prevent lens flare. I'm terribly clumsy so my camera and lenses need all the protection they can get! I've dropped my camera and bashed my lenses more times than I care to think about. I'm absolutely sure the lens hood has saved my lens from damage many times.
One more note about protecting your lenses...
I also recommend the use of UV filters on all your lenses. ALL my lenses have UV filters which remain on AT ALL TIMES. If you're paying hundreds or thousands of dollars for a lens it PAYS to have a UV filter to protect the lens from scratches and breaks.
Here's an image with lens flare: