Excited electrons emit light waves, and just so happens, the opposite is true: light waves can excite electrons. When electrons are excited by light waves, they jump to a higher energy level. When they fall back to their original energy level, the electrons reemit the light. This process is called scattering. However, when the light is reemitted by scattering, not all of the energy is given back to the light wave, but instead, some is lost to the particle. This will result in a light wave of lower frequency and wavelength as described by Compton's shift formula:
When light is scattered on an object smaller than the wavelength of light, the process is called Rayleigh scattering. Because of the nature of Rayleigh scattering -- light waves scattered by objects smaller than its wavelength -- it is very frequency dependent. Higher frequency, shorter wavelength, light are scattered the most while lower frequency, longer wavelength, light is scattered the least by very small particles.
The color of the sky is the direct result of Rayleigh scattering of the sunlight. Lower frequency light waves, such as red, are able to pass though a network of air particles better than higher frequency light waves, such as blue. During the day, the particles in the atmosphere will scatter the sunlight and lower its frequency to somewhere in the blue range. At sunset, the light waves from the sun have to travel a greater distance to reach us. Because of that, all of the light waves have been scattered so much that it lowers the frequency to the other end of our visible range: red.
Why is the Sky Blue?
Next article: Refraction. Yes, it bends.