For an animation describing M31, click HERE
The study of distant galaxies has come about because of LARGE telescopes. Around 1920, Edwin Hubble (for whom the Hubble Space Telescope is named after) began looking closely at the great ``spiral nebulae''. There had been much debate as to their location: In the galaxy or were they ``island universes''?
Hubble made an important discovery: He found Cepheids in M31! This allowed him to estimate the distance to M31.
Cepheids are stars showing a periodic variation in their brightness, the period of the light variation being related to their absolute luminosity. This showed M31 to be WAY WAY WAY far away, and outside of our own Galaxy. And thus begins the field of Extragalactic Astronomy.
Click HERE for an animation of how The Hubble Space Telescope located and measured the pulsations of a Cepheid Variable in galaxy M100.