There are many proximate causes for changes to the color of the sky, but they all involve the way light is diffracted through the air. Light from the sun can be bent as it moves through the Earth's atmosphere, and the wavelengths of light that are able to pass most easily through the air give the sky its color.
Light from the sun is white. White light is composed of all of the colors visible to humans. As this light passes through the oxygen-rich atmosphere around the Earth, the short wavelengths of light that correspond to the colors violet and indigo are filtered out, and their wavelengths spread across the sky. At sunrise and sunset, when the sun is close to the local horizon, light must pass through more air before reaching the observer. This spreads light out more than usual, leaving primarily the longer wavelengths of yellow, orange and red to be seen.
Particles in the air can create a similar effect. Sometimes a volcanic eruption, industrial pollution or forest fire delivers large quantities of ash and dust to the upper atmosphere. This tends to darken the surface and scatter light in ways that turn the sky different colors.