No, they're not just ornamental.
When I first started out, I thought cameras with lens hoods looked so much cooler and professional than the ones without them. I know I'm not the only one! The same thing goes for cinema cameras with matte boxes. I bought one of those sexy numbers before I really understood what they did—but they do do something and it's important and oftentimes necessary if you want to capture the images you want.
In this video, David Bergman of Adorama TV goes over the basics of lens hoods: what they are, how they work, and why you might want to have one always on hand while shooting your films. Check it out below.
The purpose of a lens hood is to block unwanted light that is coming into your lens. Why would you want to do this? Well, occasionally light will come in at a certain angle and create lens flares and bright spots, which lower the contrast of your overall image.
Sometimes, yeah, you might be all about it—lens flares can produce an attractive look that you might want to include in your shot—but when you aren't, you've got a lens hood that can most likely block out the light that you don't want washing out your shot.
Bergman also mentions that he likes to keep his lens hood on at all times, removing it only when necessary. This is because it provides an added layer of protection in case you bang your lens against something. Not a bad idea.