Using special equipment like a spectrograph or a spectroscope, astronomers can split light from space into a spectrum and examine its spectral lines to infer what compounds are emitted or absorbed. Additionally, astronomers can learn about the density and temperature of the emitting or absorbing compounds and what the magnetic field strength was like in the environment where the light was emitted or absorbed. From spectroscopy, we have learned that stars are mostly made of hydrogen, that Saturn's moon Titan has methane in its atmosphere, that comets contain a large amount of water, and much, much more.
It was by using spectroscopy that we discovered the first extrasolar planets. We cannot yet do spectroscopy on the planets themselves because we cannot see them against the overwhelming glare of their stars, but we can easily do spectroscopy on the planets' stars. To understand why this is important, it is necessary to understand the Doppler effect of light.
Most people are familiar with the Doppler effect of sound: sound waves sound higher pitched when the object emitting them is approaching and lower pitched when the object is moving away (think of the difference in pitch a police siren makes as it approaches, passes, and then moves away). This is because the sound waves are compressed when they are approaching and stretched out when they are receding (shorter wavelength equals higher pitch and vice versa). To help visualize this, click here to experiment with a Doppler effect applet.
Light waves do the same thing as sound waves, though a light source must be moving much, much faster than a sound source for its Doppler effect to be noticeable. Light waves are compressed when a light source is approaching and stretched out when the source is receding. We say that light from a source moving towards us is blue-shifted since its light waves are shifted to the bluer (shorter wavelength) part of the electromagnetic spectrum and that light from a source moving away is red-shifted since its waves are shifted toward the redder (longer wavelength) region. When light is red- or blue-shifted, its spectral lines move correspondingly. We know an ordinary sodium absorption spectrum should look something like this with its lines in the yellowish region:
If, however, the spectral lines are shifted, we could infer that the source of the light is moving towards or away from us:
The spectrum above shows blue-shifted sodium lines, so astronomers could conclude that the source emitting the spectrum is moving towards us and could calculate what its speed must be to produce the observed shift. When a planet orbits a star, its gravity tugs on it, forcing the star to move in a small circle as the planet orbits. Depending on whether the star is moving away from or toward us, its spectral lines will shift accordingly. Astronomers can measure these shifts to determine how fast the star is moving and calculate the mass of the planet that must be tugging on it. This is currently by far the most successful and widely used method for discovering extrasolar planets.
New Worlds Observer will find planets differently. It will block out the starlight completely using a starshade and will be able to see the planets directly. It will then be able to do spectroscopy on the planets to probe not their red-shifts or blue-shifts, but the compositions of their atmospheres. Knowing what extrasolar planet atmospheres are made of will tell us many things...possibly even whether the planet has life!