A rainbow is a quite commen weather phenomenon. For a typical rainbow you need two requirements: sunshine and raindrops. The observer needs the sun in the rear and raindrops in the direction of view.
The sunbeams hit the raindrops, that are in front of the observer. At the interface between air and raindrop the sunlight is refracted. At the opposite site inside the raindrop the light is reflected. After that the light is refracted a second time and goes now to the viewing direction of the observer. Illustrative images of the light refraction concerning the rainbow you can find here.
Why are there colors? As the intensity of the refraction is dependent on the wave length of the light. The refracting angle of red light is smaller compared to blue light.
Sometimes you can see a secondary rainbow a little exteriorly of the main rainbow. The order of the colors is inverted compared to the main rainbow. The exterior rainbow is weaker, because the formation requires two reflections inside the raindrop. Every reflection means loss of intensity, since a part of the light is refracted and not reflected. Theorectically there are rainbows with three or more reflections inside the raindrop. But they are usually not visible for human beings due to the strong weakening.