The effect, known as Rayleigh scattering, happens as photons of light pass through thicker atmosphere at the Earth's surface, rather than the thinner air overhead. The photons collide and bounce off the air molecules and scatter. Because the air is thicker and light has to travel further, most of the blue and green light has been scattered out, leaving only orange and red, which is what we see at sunset.