Rayleigh scattering refers to the scattering of light by small gas molecules, with shorter wavelengths (blue light) being scattered more effectively than longer wavelengths (red light). This answers the popular question of "why is the sky blue?". During sunset, when the sun is lower on the horizon, more of the shorter wavelengths are scattered, leaving behind a dominance of red light, creating the iconic reddish sunset colors. Pollution can enhance the scattering effect, leading to more vibrant and dramatic sunset colors. Clouds, on the other hand, scatter all visible light equally, appearing white, although they may sometimes appear gray due to shading.
Light interacts with particles and gas molecules in the air. It can be absorbed or scattered, both by physical particles and by gasses - the small gas molecules that we find in the air serving to interrupt the path of light. This is what is called Raleigh Scattering.
This scattering of the light depends on the wavelength and so the higher energy parts of the light spectrum (smaller wavelengths) get scattered more strongly than the larger wavelengths. Or, in other terms, the blue light is scattered more effectively than the red light by the air molecules. So a consequence is that if the sun is out and high in the sky the blue light is getting scattered more and when we look at the sky we see the diffuse blue light from the Raleigh scattering of the sunlight. The blue sky above the Golden Gate Bridge shows this well.
Now, in the evening when the sun sets or goes down on the horizon, our viewing angle changes and we are looking at light from the sun that has passed through considerably more of our atmosphere, much of it closer to the earth’s surface where it is denser.
The same process means that a significant proportion of the short and medium wave light, blue and green, is removed from the path of the observer through scattering. The remaining light, the longer wavelength and least energetic red, gets scattered least. The net effect of this removal of shorter wavelengths and retention of longer wavelengths is that the light appears more reddish in colour - the iconic sunset.
Again, the Golden Gate Bridge but with the sun at a different angle - more of the energetic spectrum is scattered away, leaving behind a dominance of red light.
The colors of the sunset can be emphasized by pollution. Not only gas molecules scatter light but also atmospheric particles. The source of these particles can be from combustion processes such as cars or power plants but also wildfires and other natural sources. For the particles too, the scattering is wavelength or energy dependent meaning that the more energetic, blue part of the spectrum is scattered more than the less energetic red part. As a consequence when you have many particles in the air from pollution, let’s say wildfires, the scattering by gasses will be enhanced by the scattering of these particles and the colors we perceive might be even more vibrant and strong with more dramatic yellows and reds.
This photo was taken in a SanDiego wildfire. The More energetic blue parts of the spectrum are scattered away, leaving only the less energetic yellow and red parts of the spectrum.
Clouds, on the other hand, are white as the light is scattered largely equally by larger water droplets and hence clouds scatter all visible light and appear white. That clouds or part thereof sometimes appear grayish is typically a “shade” effect.