Take a look at light through a prism and notice all the different colors that you can see. Light that looks white to our eyes actually is made up of many different colors. Each color can be thought of as a light wave with a different wavelength (or size). Within the small range of wavelengths (or colors) that we can see with our eyes, the shorter waves are blue and the longer ones are red. Colors such as green, yellow, and orange lie in between the blue and red ends of the visible spectrum.
When light comes from the sun, all these light waves of different wavelengths travel through empty space. When they reach Earth’s atmosphere, the light waves can interact with particles in the air like dust, water droplets, and ice crystals. Because of the extremely small size of visible light waves (less than one millionth of a meter), these light waves also interact the tiny gas molecules that make up the air itself. The light waves bounce off these particles just like you might bounce and get jostled in a busy hallway. As the light waves bounce in lots of different directions, we say they have been scattered.
How light waves get scattered depends strongly on the size of the particle compared with the wavelength of the light. Particles that are small compared with the light wavelength scatter blue light more strongly than red light. Because of this, the tiny gas molecules that make up our Earth’s atmosphere (mostly oxygen and nitrogen) scatter the blue portion of sunlight in all directions, creating an effect that we see as a blue sky.
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. The result is that the sunlight takes on an orange or red cast, which we can see reflected from clouds or other objects as a colorful sunset (or sunrise).
Small particles of dust and pollution in the air can contribute to (and sometimes even enhance) these colors, but the primary cause of a blue sky and orange/red sunsets or sunrises is scattering by the gas molecules that make up our atmosphere. Large particles of pollution or dust scatter light in a way that changes much less for different colors. The result is that a dusty or polluted sky is usually more grayish white than blue.
Similarly, cloud droplets (typically 10 millionths to 100 millionths of a meter) are much larger than visible light waves, so they scatter light without much color variation. This is why light scattered by clouds takes on the same color as the incoming light. For example, clouds will appear white or gray at midday and orange or red at sunrise or sunset. In this way, clouds act as a screen on which nature’s colors are painted. This is why sunsets or sunrises are so much prettier when some clouds are available to show us the colors.