
A massive foreground object such as a galaxy or a galaxy cluster (including, of course, dark matter) can brighten and magnify a distant object. This is called gravitational lensing. Light from the distant object radiates out in all directions, but the massive foreground object bends some of these light rays towards the observer that normally would have continued on in a different direction, as shown in the illustration above.
The image we see is brighter because more light rays are directed our way. The image we see is also magnified because the gravitational lens gives the distant object a larger angular size, making it appear to be much closer to us. Again, the illustration above will help you understand why these effects occur.
Of course, unless the foreground object is a star or black hole or some other small spherical object with a reasonably uniform mass distribution, the gravitational lens effect will be complex and distorted, as illustrated below.

There can be certain locations in a gravitational lens where light from a small region in the background becomes enormously magnified by a factor of up to 10,000 times. These regions are called caustics. Though the concept of a caustic is a bit difficult to describe or illustrate, here is a video of optical caustics caused by a laser pointer shining through a plastic disc with a lumpy surface.
References
How gravitational lensing acts as a magnifying glass — diagram
Different types of gravitational lenses
Caustic Projection Optical Element
Rodríguez, J. M. D. (2026). The First Stars. Scientific American, 334(2), 38. https://doi.org/10.1038/scientificamerican022026-2z1ygyIpj7gCMVn01NrfpU