These openings in the bodywork are either decorations which may or may not have an opening for air to pass through, or they are functional openings that direct air to some point within the vehicle. Ram air is one of the more common uses for these vents, though they can be also used to direct air to the brakes (to cool them down) or for aerodynamic purposes.
The most well-known type of vent is a hood scoop, which is a popular method for getting air into the engine bay without passing it through the heated radiator. While some are just a decorative piece, the functional ones usually serve as source for forced induction (because of their location, they rarely serve any other purpose). Some vents on the hood allow hot engine bay air to escape, but these are not hood scoops.
There is a special intake vent design called a NACA Duct (pictured at the right) which is found on many racing vehicles due to its low-drag design. NACA stands for National Advisory Committee for Aeronautics, the team of engineers that designed it in 1945. It was designed for aircraft, whose speed made aerodynamic efficency quite important, and it soon found use in streamlined racing cars, as well as a few high-performance production cars.
Some ducts are designed to allow air to enter one area of the body and exit elsewhere that would be difficult to do without the use of such ducts. Because of the complexity of this, most production vehicles don't have ductwork because the engineering involved would raise the price of production.