As defined in Wikipedia, refraction is:
The change in direction of a wave due to a change in its transmission medium.
In our case, the wave changing direction is the visible light, and the transmission medium is atmospheric air.
Air temperature varies along the height, decreasing from surface to tropopause, approximately at 11.000 meters above sea level.
This temperature change modifies air properties, specifically it changes density and so it changes its refractive index.
When looking at a distant mountain, the line of sight is not always at the same height above sea level, as shown in this figure:
This variation causes the travelling light to cross air at different conditions, curving its trajectory as a consequence of changing refractive index.
This light curving effect of refraction can be clearly seen in this picture of the rising sun, with a deformed shape as a consequence:
For more information: