Why is the sky blue and the sunset red?
A game of light and air
Sunlight looks white, but it is really made of all the colours of the rainbow — a prism or raindrops reveal them. Each colour is a wave of a different length: red is long, blue and violet are short.
Air molecules (nitrogen, oxygen) scatter light, but unevenly: short waves are scattered far more strongly (to the 4th power). This is Rayleigh scattering. Blue light bounces into our eyes from every part of the sky — so the whole sky is blue. Violet scatters too, but there is less of it in sunlight and our eyes are less sensitive to it.
At sunset, light travels a much longer path through the air — the blue is scattered away on the journey, while red and orange get through. With lots of dust or volcanic ash, sunsets turn even redder — after Krakatoa (1883) the whole world saw crimson evenings.
On Mars it is the other way round: the dust is reddish, the daytime sky is butterscotch, and the sunset is blue! On the Moon there is no air — the sky is black even by day and the stars are visible. So the colour of a sky is a story about a planet's 'air'.