When the sun rays travel through a lot of air, such as during sunrise or sunset, most of the blue light is scattered out and what remains is red. When we look at the sky away from the Sun, what we observe are the scattered light, which is more blue than red. Bending of light rays . Whenever light enters a medium the angle changes more towards the normal. The index of refraction of the atmosphere is close to one, but the amount above one is the cause of atmospheric refraction that makes the Sun appear higher above the horizon than its real location.
Index of refraction is wavelength dependent.
That is different wavelength waves bend by different angles. This is the reason a prism breaks sunlight into its colors. The same is also true with raindrops that form rainbows. If the angle of emergence is greater than 90 degrees, it is totally internal reflection. The distance between the focus and lens is the focal length.