You will need:
The heavier the object, the more gravity it has. Very heavy objects such as black holes or clusters of objects such as galaxies can have a lot of gravity. When these heavy objects pass in front of a distant star, galaxy or nebulae, the light from those distant objects can be bent by the heavy object passing in front.
Why? Well, it turns out that gravity seems to be a consequence of space being warped by an object. The heavier object, the more the space surrounding the object gets warped. As light travels towards us from a distant object it can follow the bent space around the heavy object and as such the heavy object can act like a lens!
This effect means that astronomers can actually look around massive objects like galaxy clusters for the focal point of light coming from even further distant objects. Once that focal point is found you have effectively used the galaxy clusters itself as part of a giant cosmic telescope.
NB: more correctly; space & time are linked together so technically both space & time can get warped by heavy objects (called spacetime).
Gravitational lensing diagram by NASA. Image credit: NASA/JPL-Caltech
More information about gravitational lensing by NASA and Space.com