Here's why:
* Refraction: The bending of light as it passes from one medium to another is called refraction. The amount of bending depends on the difference in the refractive indices of the two media.
* Density Gradient: The Earth's atmosphere has a decreasing density as you go higher. The air near the surface is denser than the air further up.
* Snell's Law: Snell's Law describes the relationship between the angle of incidence, angle of refraction, and the refractive indices of the two media. As light moves from a denser medium (near the surface) to a less dense medium (higher in the atmosphere), it bends away from the normal.
In summary: The light ray bends away from the normal because it is moving from a denser medium (lower atmosphere) to a less dense medium (higher atmosphere), causing the light to speed up and bend away from the perpendicular.
This phenomenon is why stars appear higher in the sky than they actually are, and why the sun appears to set later than it actually does.