Small molecules, short waves
Sunlight contains all colours, from red with a wavelength of about 720 nanometres to violet at about 380. In the air it meets molecules, mainly nitrogen and oxygen. They are much smaller than the wavelength and scatter short waves much more strongly than long ones. Lord Rayleigh described this in 1871.
Your guess
Light at 400 nanometres versus red at 700: how much more strongly is it scattered?
Why not violet?
Violet has the shortest wavelength and is scattered even more than blue. But sunlight contains less violet, and the high atmosphere absorbs some of it. And our eyes are less sensitive to violet. The mix of scattered blue and violet looks to us like blue mixed with white – a pale sky blue.
Red in the evening
At sunrise and sunset the Sun is low. Its light then crosses a thicker layer of air, and the blue is scattered out along the way. What remains is red and orange. Blue sky and red sunset come from the same scattering. If there is a lot of dust or pollution in the air, the sunset turns redder.

