We see a blue sky, because of the way the atmosphere interacts with sunlight.
White light, including sunlight, is made up of many different colors of light, each with its own corresponding wavelength.
Several different things can happen when this light encounters matter.
For instance, if sunlight passes through a transparent material, such as water, those light waves will refract, or bend, because light changes speed as it travels from one medium (air) to another (water). Prisms break up white light into its constituent colors, because different wavelengths of light refract at different angles — the colors travel at different speeds — as they pass through the prism.
Alternatively, some objects, such as mirrors, reflect light in a single direction. Other objects can cause light to scatter in many directions.
The blueness of the sky is the result of a particular type of scattering called Rayleigh scattering, which refers to the selective scattering of light off of particles that are no bigger than one-tenth the wavelength of the light.
Importantly, Rayleigh scattering is heavily dependent on the wavelength of light, with lower wavelength light being scattered most. In the lower atmosphere, tiny oxygen and nitrogen molecules scatter short-wavelength light, such blue and violet light, to a far greater degree than than long-wavelength light, such as red and yellow. In fact, the scattering of 400-nanometer light (violet) is 9.4 times greater than the scattering of 700-nm light (red).
Though the atmospheric particles scatter violet more than blue (450-nm light), the sky appears blue, because our eyes are more sensitive to blue light and because some of the violet light is absorbed in the upper atmosphere.
During sunrise or sunset, the sun's light has to pass through more of the atmosphere to reach your eyes. Even more of the blue and violet light gets scattered, allowing the reds and yellows to shine through.