Why is the Sky Blue?
A clear cloudless day-time sky is blue because molecules in the air scatter blue light from the sun more than they scatter red light. When we look towards the sun at sunset, we see red and orange colours because the blue light has been scattered out and away from the line of sight.
The white light from the sun is a mixture of all colours of the rainbow. This was demonstrated by Isaac Newton, who used a prism to separate the different colours and so form a spectrum. The colours of light are distinguished by their different wavelengths. The visible part of the spectrum ranges from red light with a wavelength of about 720 nm, to violet with a wavelength of about 380 nm, with orange, yellow, green, blue and indigo between. The three different types of colour receptors in the retina of the human eye respond most strongly to red, green and blue wavelengths, giving us our colour vision.
The first steps towards correctly explaining the colour of the sky were taken by John Tyndall in 1859. He discovered that when light passes through a clear fluid holding small particles in suspension, the shorter blue wavelengths are scattered more strongly than the red. This can be demonstrated by shining a beam of white light through a tank of water with a little milk or soap mixed in. From the side, the beam can be seen by the blue light it scatters; but the light seen directly from the end is reddened after it has passed through the tank. The scattered light can also be shown to be polarised using a filter of polarised light, just as the sky appears a deeper blue through polaroid sun glasses.
This is most correctly called the Tyndall effect, but it is more commonly known to physicists as Rayleigh scattering--after Lord Rayleigh, who studied it in more detail a few years later. He showed that the amount of light scattered is inversely proportional to the fourth power of wavelength for sufficiently small particles. It follows that blue light is scattered more than red light by a factor of (700/400)4 ~= 10.
Dust or Molecules?
Tyndall and Rayleigh thought that the blue colour of the sky must be due to small particles of dust and droplets of water vapour in the atmosphere. Even today, people sometimes incorrectly say that this is the case. Later scientists realised that if this were true, there would be more variation of sky colour with humidity or haze conditions than was actually observed, so they supposed correctly that the molecules of oxygen and nitrogen in the air are sufficient to account for the scattering. The case was finally settled by Einstein in 1911, who calculated the detailed formula for the scattering of light from molecules; and this was found to be in agreement with experiment. He was even able to use the calculation as a further verification of Avogadro's number when compared with observation. The molecules are able to scatter light because the electromagnetic field of the light waves induces electric dipole moments in the molecules.
Why not violet?
If shorter wavelengths are scattered most strongly, then there is a puzzle as to why the sky does not appear violet, the colour with the shortest visible wavelength. The spectrum of light emission from the sun is not constant at all wavelengths, and additionally is absorbed by the high atmosphere, so there is less violet in the light. Our eyes are also less sensitive to violet. That's part of the answer; yet a rainbow shows that there remains a significant amount of visible light coloured indigo and violet beyond the blue. The rest of the answer to this puzzle lies in the way our vision works. We have three types of colour receptors, or cones, in our retina. They are called red, blue and green because they respond most strongly to light at those wavelengths. As they are stimulated in different proportions, our visual system constructs the colours we see.
When we look up at the sky, the red cones respond to the small amount of scattered red light, but also less strongly to orange and yellow wavelengths. The green cones respond to yellow and the more strongly-scattered green and green-blue wavelengths. The blue cones are stimulated by colours near blue wavelengths which are very strongly scattered. If there were no indigo and violet in the spectrum, the sky would appear blue with a slight green tinge. However, the most strongly scattered indigo and violet wavelengths stimulate the red cones slightly as well as the blue, which is why these colours appear blue with an added red tinge. The net effect is that the red and green cones are stimulated about equally by the light from the sky, while the blue is stimulated more strongly. This combination accounts for the pale sky blue colour. It may not be a coincidence that our vision is adjusted to see the sky as a pure hue. We have evolved to fit in with our environment; and the ability to separate natural colours most clearly is probably a survival advantage.
When the air is clear the sunset will appear yellow, because the light from the sun has passed a long distance through air and some of the blue light has been scattered away. If the air is polluted with small particles, natural or otherwise, the sunset will be more red. Sunsets over the sea may also be orange, due to salt particles in the air, which are effective Tyndall scatterers. The sky around the sun is seen reddened, as well as the light coming directly from the sun. This is because all light is scattered relatively well through small angles--but blue light is then more likely to be scattered twice or more over the greater distances, leaving the yellow, red and orange colours.
Blue Haze and Blue Moon
Clouds and dust haze appear white because they consist of particles larger than the wavelengths of light, which scatter all wavelengths equally (Mie scattering). But sometimes there might be other particles in the air that are much smaller. Some mountainous regions are famous for their blue haze. Aerosols of terpenes from the vegetation react with ozone in the atmosphere to form small particles about 200 nm across, and these particles scatter the blue light. A forest fire or volcanic eruption may occasionally fill the atmosphere with fine particles of 500-800 nm across, being the right size to scatter red light. This gives the opposite to the usual Tyndall effect, and may cause the moon to have a blue tinge since the red light has been scattered out. This is a very rare phenomenon--occurring literally once in a blue moon.