At the beginning of the twentieth century, Albert Einstein developed the theory of general relativity. According to this theory, photons bend their trajectory near a massive body. The deflection is greater the more massive the object.
In reality, light propagates along the shortest path but the space (or more precisely the spacetime) in which it travels is curved by the presence of mass. In the theory of general relativity, gravitation is a consequence (and not the cause) of this curvature of spacetime. This simulation uses a simplified model of spacetime in the form of a 2D grid deformed by a mass. See the "Simplification" paragraph at the end of this text to understand the limitations of this model.
When Einstein published his theory of general relativity in 1915, he predicted not only the deflection of light as it passed near a mass but also the existence of gravitational waves. The theory establishes a completely new conception of the universe, particularly with regard to the nature of the gravitational force. Neither this very complex theory, nor even the Nobel Prize he received in 1922 (for his explanation of the photoelectric effect) made Einstein famous; he remained unknown beyond a small circle of scientists at that time.
On May 29, 1919, a solar eclipse occurred which was the occasion chosen by astronomer Arthur Eddington to measure the position of stars almost aligned with the Sun at the precise moment of the eclipse. He sought to validate the theory of general relativity stated four years earlier by Einstein. Eddington notes a deviation of the position of the stars in accordance with the predictions of the theory of general relativity. Overnight, Albert Einstein became a world celebrity as evidenced by the many headlines of the newspapers of the time.
Light can therefore be deflected by a mass. A gravitational lens is a kind of optical illusion on a cosmic scale. Under certain alignment conditions, it is possible to observe several images of the same light source located behind a massive object. Depending on the mass distribution of the deflector mass, one can observe arcs or rings (called "Einstein rings").
Simplifications: The animation illustrates how a mass changes the grid of a simplified spacetime in 3D. This representation is exaggerated for educational purposes. Real spacetime is four-dimensional (three for space - one for time). This video by Alessandro Roussel sums up the difficulty of graphically illustrating the effects of general relativity.