Rayleigh scattering
Air molecules scatter blue light far more than red, which is why the sky is blue and the setting Sun looks red.
Rayleigh scattering is the scattering of light by particles much smaller than its wavelength, such as the nitrogen and oxygen molecules of the air. Its key feature is that it depends very strongly on colour: the amount scattered is inversely proportional to the fourth power of the wavelength. Violet-blue light at 400 nanometres is therefore scattered about nine times more strongly than red light at 700 nanometres.
As sunlight crosses the sky, its blue part is bounced around in all directions and reaches our eyes from every part of the sky, so the sky looks blue. At sunrise and sunset the light reaches us through far more air; much of its blue has been scattered out along the way, and the low Sun looks yellow, orange or red.
Why is the sky not violet, since violet scatters even more? Sunlight contains less violet than blue, and our eyes are much less sensitive to it, so the mix looks blue.
Larger particles behave differently. Cloud droplets and particles of smoke or dust, comparable in size to the wavelength of light or bigger, scatter all colours more evenly (Mie scattering), which is why clouds look white or grey. Thick smoke can dim and tint the whole sky and, if dense enough, block daylight almost entirely. Light scattered by the clear sky is also partly polarised, which some navigators may have used to locate the Sun behind cloud.