So, when it’s raining, there’s a tonne of tiny water droplets hanging in the air. And those water droplets act exactly like a prism for any light that pass through them. So when you pass sunlight through the rain droplets, the sunlight is diffracted out into a spectrum of colours, which, to us, looks like a rainbow.
Here’s a ten second minutephysics video explaining it 🙂
yup Mark’s answer pretty much nailed it. But have you ever seen star wars? Tatooine, the desert planet, has two suns, which would each try and make their own rainbow. These binary star systems are also surprisingly common, so it may be that planets like this, if they have rain like us, would see double rainbows. My favourite webcomic xkcd does a really good job of exploring this: http://what-if.xkcd.com/150/