Two days ago, the question of the day was "Why is the sky blue?" For some reason, that triggered a flood of "What causes a rainbow?" questions, so let's walk through the nature of rainbows.
You know that light is made up of a collection of many colors: red, orange, yellow, green, blue, indigo, violet. That is why a prism can take in white light on one side and produce its own mini-rainbow on the other side. To understand rainbows, you have to start by understanding what is happening inside a prism to let it separate white light into its colors.
A prism is a triangular piece of glass or plastic. To get it to produce a mini-rainbow, you allow a narrow strip of white light to fall on one face of the triangle, like this:
(See this page for a neat java applet that demonstrates the dispersion of a prism.)
The dispersion of colors in a prism occurs because of something called the refractive index of the glass. Every material has a different refractive index. When light enters a material (for example, when light traveling through the air enters the glass of a prism), the difference in the refractive index of air and glass causes the light to bend. The angle of bending is different for different wavelengths of light. As the white light moves through the two faces of the prism, the different colors bend different amounts and in doing so spread out into a rainbow.
In a rainbow, raindrops in the air act as tiny prisms. Light enters the raindrop, reflects off of the side of the drop and exits. In the process, it is broken into a spectrum just like it is in a triangular glass prism, like this:
The angle between the ray of light coming in and the ray coming out of the drops is 42 degrees for red and 40 degrees for violet. You can see in this diagram that the angles cause different colors from different drops to reach your eye, forming a circular rim of color in the sky -- a rainbow! In a double rainbow, the second bow is produced because droplets can have two reflections internally and get the same effect. The droplets have to be the right size to get two reflections to work.
The next time you spot a rainbow, you will see it in a whole new light. For more information, check out How Rainbows Work.