How did we 'discover' dark matter?

Short answer: Due to a discrepancy between the density of matter which responds to electromagnetic radiation and the average calculated density of matter in the universe.

We have several ways to measure the average distribution of matter in the universe: for example, we can use the mass of an average star and the average number of stars in a galaxy, to get the average density of matter which is potentially visible (responds to electromagnetic radiation).

Alternatively, we can study the redshifts of different galaxies in a cluster, and thus determine the motion of each galaxy. This can help us calculate the gravitational force acting on each of the galaxies in the cluster, and hence we can find the mass of ALL matter in the cluster. Note how different this is from the previous method, which is for visible bodies only.

There are a few other techniques, but the essence is that the density of all matter is about 32% the critical density of the universe, but the density of matter which interacts with EM radiation is only 5% of the critical density. We call this constituents of this gap 'dark matter'.

Although it seems Fritz Zwicky can claim priority for having postulated dark matter (see freecharly's answer), Vera Ruben's observations of galaxies' rotation curves gave more evidence to the claim. The rotation curves she observed were flat ($\color{green}{\mathrm{green}}$ in the diagram below), showing that stars revolve much faster than expected based upon Newtonian mechanics ($\color{red}{\mathrm{red}}$ in the diagram below):

Observed vs. Predicted Galaxy Rotation Curve Dark matter postulate: Explains why there is much more mass in galaxies than the mass that emits light

Alternative theories of gravity (Modified Newtonian Dynamics (MOND), Weber's gravitational force, etc.): Explains galaxy rotation curves assuming we can "weigh" galaxies accurately based upon the light they emit.

Dark matter was first proposed already in 1933 by the Swiss astronomer Fritz Zwicky based on his observations of gravitational abnormalities in the Coma Galaxy Cluster using the virial theorem.