This saying can be traced back as far as the Bible – and a red sunset does typically presage clear skies the following day. However, this only holds true in regions where weather systems mostly travel from west to east, which includes most mid-latitude areas such as the UK.
During the daytime, the sky appears blue because dust and particles in the atmosphere mostly scatter the blue portion of sunlight. When the Sun is low on the horizon, however, the sunlight passes through more air than when it’s higher in the sky. This means that by the time the light reaches us, most of the blue light has been scattered away from our line of sight – leaving the oranges and reds.
A particularly red sky results from high atmospheric pressure, where particles are more highly concentrated and more blue light is scattered. A red sunset therefore usually means that there’s an area of high pressure (which is associated with clear skies) approaching from the west.
If, on the other hand, you observe a red sunrise (ie, in the east), it suggests that a high pressure area has already passed overhead and is moving away. Lower pressure air will soon take its place, bringing rain or even storms – hence the phrase’s companion, “red sky at morning, shepherd’s warning”.