For a rainbow to form, water droplets must be present in the air in front of an observer and the sun must be shining from behind the observer. As sunlight enters a droplet, it is refracted (it slows and bends), with violet light bending the most and red light the least. Much of the light passes on through the drop, but some strikes the backside of the drop at such an angle that it is reflected back and is again refracted as it leaves the drop and passes to the observer's eyes. It takes myriads of droplets to produce the brilliant colors of a rainbow.
Image Courtesy of Carlye Calvin/University Corporation for Atmospheric Research