I heard about the golden hour, but yesterday I saw golden and red colored patches in the sky even after sunset. Why does it happen? And I would like to know more about the science behind the golden hour.
This is a result of Rayleigh scattering, the same reason the sky is blue. As the sun sets the optical path for a photon passing through the atmosphere to your eye increases. Because of this increased distance through the atmosphere, more scattering occurs and the shorter wavelengths are scattered away, leaving the longer wavelengths. This results in light that is reaching your eye tending toward red and the yellow to orange and gold hues are produced on the way to red.
The reason you can still see this persist after sunset is because the sun below the horizon can still reach you through scattering though clouds can enhance this effect (because clouds are good at scattering all visible wavelengths and clouds you can see can be illuminated by a sun you cannot see). This is the same principle as above, with the addition of the scattering by the cloud. You'll have Rayleigh scattering on the way to the cloud through the atmosphere, uniform scattering off the cloud and then more Rayleigh scattering between the cloud and your eye. The longer these distances become, the more red the light reaching your eye has become, and thus the sky will take on the reddening hue (with the yellow/orange/gold colors in the transition to red).