Rainbows only occur when the Sun is low in the sky and behind the viewer, shining at just the right angle into air full of water droplets, such as a rain shower. When sunlight shines into a water droplet, it exits it at different angles depending on its different wavelengths. This is called refraction and it splits up the light into its rainbow colors.