When sunlight enters a rain droplet, it is refracted (bends) and dispersed (separated into different colors because different wavelengths refract at slightly different angles). This dispersed light then travels to the back inner surface of the droplet, where it undergoes internal reflection. Finally, as the light exits the droplet, it is refracted again, further separating the colors and sending them towards the observer's eye at specific angles depending on the wavelength, creating the arc of the rainbow. For the primary rainbow, the reflection at the back surface is usually total internal reflection, but even if not strictly TIR for all angles, it is an internal reflection that directs the light back towards the observer.