Refraction is the way light bends when it hits a certain medium such as, water, air, glass, etc., so, in a rainbow, there are tiny droplets of water in the air, thus refracting the light and spliting up the light into its basic colors. Similarly with the sky. The sky appears blue because of the way the light is refracting.