|MadSci Network: Earth Sciences|
This is sort of a common question; I guess because it such a part of our daily lives. I've included pointers to previous Mad Scientist answers that will add to my answer below.
When sunlight leaves the sun it consists of all of the colors of the rainbow. As it enters the atmosphere a process called Rayleigh scattering occurs which affects the different colors of sunlight to differing degrees. The shortest wavelengths, blue and violet, are scattered the most. They bounce around and those that reach our eyes appear to be coming from all over the sky. The longer wavelengths like yellow and red travel without being scattered much, and only enter our eyes when we look directly at the sun. The blue color is removed from the direct sunlight and the sun appears to be yellow instead of white. This effect becomes more pronounced as the thickness of the atmosphere through which the light muss pass increases, as it does while the sun goes down in the evening. As more short and medium wavelengths are removed from the direct sunlight by scattering the sun begins to appear more orange or red.
The sky appears to be a source of blue light because the blue light from the sun is bouncing all around the atmosphere and some of it is bounced toward your eye from all directions. The atoms in the atmosphere are pretty small, but larger particles will scatter more wavelengths. The droplets of water in a cloud, for example, can scatter all of the wavelengths of ordinary sunlight, thus a cloud appears to be a source of white light. See the other Mad Scientist answers cited below for more information.
Are there other atmospheres that might scatter other colors of light?
Why is the sky blue?
Try the links in the MadSci Library for more information on Earth Sciences.