Why Is the Sky Blue?
A simple effect of sunlight and air explains the colour of the daytime sky and the red of sunsets.

Sunlight looks white, but it is a mixture of all the colours of the rainbow. When that light enters Earth's atmosphere, it collides with gas molecules such as nitrogen and oxygen and is scattered in all directions.
The amount of scattering depends on wavelength. Blue light has a short wavelength and is scattered much more strongly than red light, an effect known as Rayleigh scattering. As a result, scattered blue light reaches your eyes from every part of the sky, and the sky looks blue.
You might ask why the sky is not violet, since violet light is scattered even more. The reasons are that the Sun emits less violet light than blue, part of it is absorbed high in the atmosphere, and human eyes are less sensitive to violet.
At sunrise and sunset the Sun's light travels through much more air to reach you. Most of the blue light is scattered away along the way, leaving the longer red and orange wavelengths to colour the horizon.