1. Astronomers noticed years ago that galaxies and galaxy clusters don't orbit around their centers of mass like expected -- e.g., objects far from the center orbited much faster than gravitational laws expected. Some scientists speculated that there might be a large cloud of unseen matter around and within these distant objects that could help explain the orbits of the visible objects.
2. Anything with mass (or energy) bends the fabric of space-time, and that causes passing light to bend along such curvature. It can create an effect known as "gravitational lensing" if a distant galaxy's light goes around objects with mass. General Relativity provides a means to calculate the light bending.
3. Astronomers noticed that light from distant galaxies gets bent far more than expected from what's visible in more nearby galaxies, so that's an indication that there's indeed more mass than what's expected.
4. A "smoking gun" for dark matter was the observation of the "Bullet Cluster," galaxies that collided. Most of the mass from ordinary matter rubbed against each other and heated up near the center. Objects like stars, which are separated by vast distances and actually aren't the source of most galactic mass despite their high densities, passed by each other. Thus, most of the gravitational lensing should have been observed near the center where the diffuse gas molecules collided. Instead, most lensing was detected near the outside with the stars (which had collectively less mass). That's an indication that the mysterious matter, called dark matter, also mostly passed through with little interaction to other particles.
5. Nobody yet knows what comprises dark matter, but it apparently has lots of mass and it apparently doesn't interact with ordinary visible matter very much, if at all, except by gravity.