A rainbow is caused by the reflection and refraction of light in water droplets, which disperses white sunlight into the colors of the visible spectrum. As light enters a raindrop, it bends at different angles based on wavelength, with some light reflecting off the back of the droplet. This results in different colors being seen from different raindrop angles. To see a rainbow, an observer must have their back to the sun while rain falls in an arc of sky approximately 42 degrees above the horizon, with each raindrop acting like a prism.