Rainbows are formed when sunlight is refracted, or bent, while entering raindrops in the air and then reflected inside the raindrop before being refracted again as it exits the drop. This process separates the sunlight into its various colors, creating the beautiful arc of colors we see in the sky.