When passing from one medium to another, if the refractive indices of these media are different. For example, when going from air to water. When the beam propagates in the air. The density of the air is not the same everywhere, therefore the speed of propagation of the beam is different. When a light beam propagates in the gravitational field of massive bodies. The reason is the action of gravity.
Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.