An individual raindrop has a different shape and consistency than a glass prism, but it affects light in a similar way. When white sunlight hits a collection of raindrops at a fairly low angle, you can see the component colors red, orange, yellow, green, blue, indigo and violet -- a rainbow. For simplicity's sake, we'll only look at red and violet, the colors of light on the ends of the visible light spectrum.
The diagram below shows what happens when the sunlight hits one individual raindrop.
When the white light passes from air into the drop of water, the component colors of light slow down to different speeds depending on their frequency. The violet light bends at a relatively sharp angle when it enters the raindrop. At the right-hand side of the drop, some of the light passes back out into the air, and the rest is reflected backward. Some of the reflected light passes out of the left side of the drop, bending as it moves into the air again.
In this way, each individual raindrop disperses white sunlight into its component colors. So why do we see wide bands of color, as if different rainy areas were dispersing a different single color? Because we only see one color from each raindrop. You can see how this works in the diagram below.
When raindrop A disperses light, only the red light exits at the correct angle to travel to the observer's eyes. The other colored beams exit at a lower angle, so the observer doesn't see them. The sunlight will hit all the surrounding raindrops in the same way, so they will all bounce red light onto the observer.
Raindrop B is much lower in the sky, so it doesn't bounce red light to the observer. At its height, the violet light exits at the correct angle to travel to the observer's eye. All the drops surrounding raindrop B bounce light in the same way. The raindrops in between A and B all bounce different colors of light to the observer, so the observer sees the full color spectrum. If you were up above the rain, you would see the rainbow as a full circle, because the light would bounce back from all around you. On the ground, we see the arc of the rainbow that is visible above the horizon.
Sometimes you see a double rainbow -- a sharp rainbow with a fainter rainbow on top of it. The fainter rainbow is produced in the same way as the sharper rainbow, but instead of the light reflecting once inside the raindrop, it's reflected twice. As a result of this double reflection, the light exits the raindrop at a different angle, so we see it higher up. If you look carefully, you'll see that the colors in the second rainbow are in the reverse order of the primary rainbow.
And that's really all there is to rainbows. Light and water happen to combine in just the right way to paint a beautiful natural picture.
For more information on rainbows and other optical phenomena, check out the links below.