To understand why the sky is blue, we need to understand a little about light.
Light is a form of radiation, electromagnetic energy that travels in the form of
waves possessing electric and magnetic properties. This form of energy does not
need matter to propagate. We can characterize this energy by its wavelength -- the
distance along a wave from one crest to another. Our eyes are remote sensors
that are sensitive to light with wavelengths between approximately 0.4-0.7 microns
(one micron is a millionth of a meter or one one-hundredth the diameter of a human hair).
The table below summarizes the wavelengths for different colors of the spectrum.

When light beams interact with particles suspended in air, the energy can be scattered
or absorbed. Energy that is scattered causes a change in direction of the light path.
The amount of light that is being scattered is a function of the size of the particle
relative to the wavelength of the light falling on the particle. Particles that are
tiny compared to the wavelength of the light scatter selectively according to wavelength.
While all colors are scattered by air molecules, violet and blue are scattered most.
The sky looks blue, not violet, because our eyes are more sensitive to blue light (the sun
also emits more energy as blue light than as violet).

Photo by Scott Lindstrom

At sunset and sunrise, the sunlight passes through more atmosphere than during the
day when the sun is higher in the sky. More atmosphere means more molecules to scatter
the violet and blue light. If the path is long enough all of the blue and violet light
gets redirected out of your line of sight, while much of the yellow, orange and red
colors continue along the undeviated path between your eye and the sun. This is why sunsets
often are composed of yellow, orange and red colors.

Photo by Roland
Stull

To demonstrate the cause of blue sky in the classroom requires only a clear glass
container, water, some milk and a flashlight. First, put water in the medium sized
glass (it must be clear) and shine the flashlight through the glass. The beam of
light from the flashlight will be difficult to see in the water. Milk contains
tiny molecules of protein and fat which scatter blue light, but we must dilute the
milk to see the effect. So put a few drops of milk in a medium sized glass of water.
For those who must use 1/4 tsp. of a spice in a food recipe, instead of just a
pinch -- add 60 milliliters (about 1/4 cup) of milk to 10 liters (about 2 1/2 gallons)
of water. Now shine the light on the side of the glass. Note the light beam is now
visible as it passes through the water/milk mixture, due to scattering. Add more
drops of milk (or if you are dealing with the 2 1/2 gallon fish tank -- add about
90 milliliters, 30 at a time) until the mixture takes on a distinct blue color.
If you are demonstrating this to a non-believer, they may not observe the blue tint.
To convince them, recall that at sunset, or sunrise, the sun appears orange and red.
The reason for this is that all the blue light is scattered in all directions, and
if there are enough molecules to scatter, all the blue light will eventually be
scattered out of the sunlight. Thus, if the water/milk mixture is blue, the
flashlight beam as it leaves the glass container should take on an orange/red color.
Put a piece of paper at the end of the glass container and voila! - the flashlight
beam is orange!

So why is milk white and not blue? Because there are so many fat and protein
molecules in milk that enough light at all wavelengths gets scattered giving the
appearance of white light. Carefully look at the color of the sky on a clear
day in the afternoon . The brightest blues will appear overhead, while on the
horizon the color will be a milky blue.
The whitish tint on the horizon is due
to the scattering by many more molecules close to the ground, in addition to
scattering by haze particles.

Photo by Roland
Stull

Why does haze cause the sky to appear whitish? As a particle gets bigger, it
is no longer selective in the wavelength it scatters. You can see this change
if you carefully watch someone smoke. The smoke off the end of the cigarette
is made up of particles that are very small compared to the wavelength of visible
light, and thus appear blue, particularly if viewed against a dark background.
When you inhale the smoke into your lungs, exposing yourself to great health
hazards, some of the smoke stays suspended in your lungs until you exhale. Your
lungs are warm and moist, and the moisture begins to condense on the smoke
particles forming a type of polluted smog in your lungs (yuck!).
When you exhale, the particles have become larger due to the condensation occurring in your
lungs, large enough so that the smoke particles scatter light independent of wavelength,
and the exhaled smoke looks white.

If things are made of molecules, why doesn't everything around you look blue?
The effect is quite weak in solids and liquids because the molecules are arrayed
in a more orderly fashion and the scattered light occurs only in the forward
direction, along with all the other colors.

For more information on atmospheric optics, such as scattering, see:

Basic texts

Meteorology Today, An Introduction to Weather, Climate and the Environment,
by C. Donald Ahrens, West Publishing Company

Meteorology, The Atmosphere and the Science of Weather,
by Joseph M. Moran and Michael D. Morgan, MacMillan College Publishing Company

Clouds in a Glass of Beer, Simple Experiments in Atmospheric Physics,
by Craig F. Bohren, John Wiley & Sons, Inc.

More advanced texts

Sunsets, Twilights and Evening Skies, by Meinel, Cambridge University Press.