The daytime sky looks blue because air is not empty. Sunlight is a mix of colors. When it enters the atmosphere, molecules of nitrogen and oxygen scatter the shorter wavelengths more strongly than the longer ones. Blue light is short enough to be sent sideways in every direction, so whichever way you look away from the Sun, that scattered blue fills the view. Red and yellow travel through more directly, which is why the Sun itself looks pale or white at noon.

The effect has a name, Rayleigh scattering, and it depends on particle size being much smaller than the wavelength of light. Dust and water droplets are larger. They scatter all colors more evenly and turn the sky milky or gray. After a volcanic eruption or in a desert haze, sunsets can look copper and violet because extra particles strip blue from the remaining beam.

At the horizon the sky is often paler. You are looking through a thicker column of air, and more scattering plus more dust washes the color out. At night the same air is still there, but there is no bright Sun to scatter, so the sky goes black except where moonlight, cities, or the glow of the Milky Way provide a weaker source. The blue is not a paint on the heavens. It is sunlight being redirected by the gas we breathe.
