The
formation of a rainbow involves a series of physical phenomena -
reflection, refraction, dispersion and total internal reflection. The occorence of each of these is due to the interaction of light with air and water and the boundaries between them.
As light enters the raindrop, it is refracted (the path of the light is
bent to a different angle), and some of the light is reflected by the
internal, curved, mirror-like surface of the raindrop, and finally
is refracted back out the raindrop toward the observer.