Astronomers use high resolution spectroscopy and the Doppler effect to discover extrasolar planets, which are planets outside our solar system.
Extrasolar planets orbit stars other than the Sun. After decades of trying, the first confirmed extrasolar planet was discovered in 1995. In April 2007, over 200 extrasolar planets later, the first earthlike extrasolar was finally discovered.
Stars are much larger, more massive, and brighter than planets. A lone planet is very difficult to detect at stellar distances. A planet close to a much brighter star is even harder to detect because the star's light overwhelms the planet's feeble light.
Detecting a planet orbiting another star is like watching a large forest fire from a distant mountaintop and trying to see a fire fighter holding a burning match. So astronomers must discover extrasolar planets indirectly using the Doppler effect and high resolution spectroscopy.
The Doppler effect allows astronomers to tell if a star is moving towards or away from us by shifts in spectral lines. If a spectral line from a star is shifted to longer wavelengths, a red shift, it is moving away from us. If it is shifted to shorter wavelengths, a blue shift, the star is moving towards us. A larger shift tells us the star is moving faster.
If a star's spectrum alternates between red and blue shifts with a regular period, the star is orbiting something. Astronomers detect some binary systems (two stars orbiting each other) using this effect. They see two sets of spectral lines, one from each star, that alternate between red and blue shifts. While one of the stars has a red shift, the other has a blue shift, so we know that when one star is moving towards us the other is moving away. These binary systems are spectroscopic binaries.
Some spectroscopic binaries only have one set of spectral lines because one of the stars is too faint for us to observe its spectrum. An extrasolar planet is like this.
Normally we say a planet orbits the star, but strictly speaking the planet and star both orbit their mutual center of mass. Think about a binary star system. If both stars have the same mass, they will orbit a point half way between them. This point is the center of mass. If one of the stars is more massive, the center of mass is closer to it. For example, if one of the stars is twice as massive as the other, the center of mass is one third of the way from the more massive star to the less massive star.
What about a planet and a star? The star is much more massive than the planet, so the center of mass of the star-planet system is very close to but not exactly at the center of the star. As the planet orbits the star - really the center of mass, the star also orbits the center of mass.
The star's orbit is however very small because it is so much more massive than the planet. Therefore the star's spectral lines have very small alternating red and blue shifts. In the mid 1990s astronomical instrumentation had improved to the point where high resolution spectroscopy was finally able to detect the small shifts from extrasolar planets. A detailed analysis of the orbits tells astronomers the mass of the unseen object orbiting the star. If it is too small to be a star or a brown dwarf, it is a planet.
The first planets detected were massive gas giants that were close to the parent star because these are the easiest planets to detect. The first earthlike extrasolar planet was not discovered until 2007 because a less massive planet produces a much smaller harder to detect motion in the parent star.