How are rainbows formed

Rainbows are formed by a combination of various factors: the physics of light, it's components and interaction that combined with the dynamics of the rain droplets and the angle of sun hitting the water droplets.
Contrary to popular belief, the rain droplets are spherical and when light passes through this denser sphere, the light is scattered due to refraction into it's component wavelengths corresponding to the VIBGYOR pattern.