As sunlight travels through the Earth's atmosphere, it gets scattered (changes its direction)by atmospheric particles. Light of shorter wavelength is scattered much more than light of longer wavelengths. The amount of scattering is inversely proportional to the fourth power of the wavelength. This is known as Rayleigh Scattering, Hence, the bluish color predominates in a clear sky, since blue has a shorter wavelength than red and is scattered much more strongly. In fact, violet gets scattered even more than blue, having a shorter wavelength. But since our eyes are more sensitive to blue than violet, we see the sky blue. Within the visible range of light, red light waves are scattered the least by atmospheric gas molecules. So at sunrise and sunset, when the sunlight travels a long path through the atmosphere to reach our eyes, the blue light has been mostly removed, leaving mostly red and yellow light remaining.