A rainbow is formed due to the following phenomena:
1. Dispersion: The splitting of white light into its constituent colors when it passes through water droplets in the atmosphere.
2. Refraction: The bending of light as it enters and exits the water droplets.
3. Internal Reflection: The light is internally reflected inside the water droplet before exiting, forming the rainbow.