What is a spectrometer, and why are they so useful in science? I've heard reference to many telescope and spacecraft that have a device known as a spectrometer, and I'm curious, what is the purpose of these device? What's the working principal behind them and what do we use them for?
 A: EM radiation, including light, is a spectrum of different wavelengths. Spectroscopy is the detailed analysis of a light signal by wavelength. Ordinary color images break up light into 3 channels (red, green, and blue), but spectroscopy is generally concerned with breaking up light into a higher number of bands (e.g. 10, 100, or more), and a spectrometer is the instrument that does just that.
The basic principle of spectrometry is simple, various methods (the most ordinary being the use of a prism) can be used to cause the different wavelengths of light to follow different paths, which can be used in combination with a monochromatic imaging sensor to record the spectrum. Alternately, multiple images of the same scene can be recorded while using different narrow band filters (either separate filters or a device which can be adjusted to pass through different wavelengths such as a fabry-perot filter).
Spectrometry has multiple uses:
Composition
Ions of different elements have different emission spectra due to the differences in electron energy levels. This makes it possible to determine the elemental composition of objects that are significantly ionized such as stars (which are composed of high temperature plasma). Additionally, at lower temperatures molecules have characteristic absorption and emission spectra which can be used to determine the composition of lower temperature objects such as planets and asteroids.
Temperature
The large scale structure of a light spectrum will be dominated by the characteristics of the black body spectrum, making it possible to determine an object's temperature.
Motion
As mentioned above the composition of an object will result in a very characteristic spectrum. However, this spectrum will be shifted a certain amount one way or another depending on whether the object is moving away or towards us, due to doppler shifting. This makes it possible to measure the relative velocity of an object along the line of sight. By studying changes in an object's motion we can infer certain information about the object such as whether or not it is orbited by another otherwise unseen object. To date this is one of the most prolific methods for detecting extrasolar planets.

Since spectroscopy splits up a light signal into many tiny buckets it's very helpful to have as much light to work with as possible, which is why most of the largest telescopes in the world (such as the Keck or VLT telescopes) spend a lot of their time collecting spectra and have very sophisticated spectrometers.
The invention of CCDs and other electronic imagers has been a gigantic boon to spectrometry, since such devices have very high quantum efficiency (meaning the vast majority of photons from the source light are converted into usable signals) and can have fairly flat spectral response curves. Most importantly, they are already finely divided into different bins spatially and they contain a huge number of individual detectors (pixels).
One of the most interesting advances in modern spectroscopy is the increasing predominance of "imaging spectrometers" in interplanetary spacecraft and observatories. Instead of merely collecting multiple color channel data for each pixel in an image these instruments collect entire spectra for every pixel. This dramatically increases the amount of data collected and the speed of data collection by a spacecraft many fold, making it possible to extract a lot more information from a single view of a planet, moon, rock or what-have-you than was possible before. A few examples of imaging spectrometers would be the Mars Reconnaissance Orbiter's CRISM, the JWST's NIRSpec, and Dawn's VIR instrument.
A: A spectrometer does something similar to what a prism does: light goes in, and gets split up into a spectrum. If you shine white light through a prism, a rainbow comes out the other side.
But not all things give off white light. In fact, each element, when excited gives off a unique set of wavelengths that act like its signature: these are called emission lines. As well, each element absorbs certain wavelengths of light, and light reflected off this element will be missing those wavelegths: absorption lines. Emission lines and absorption lines can be examined using a spectrometer, which can measure which wavelengths of light are present or missing.
Since the emission and absorption lines are unique for every element, using a spectrometer can help scientists determine the composition of whatever they are studying. This is one (the only?) way we're able to measure the composition of stars from light-years away: just break down the light they are giving off and see which wavelengths are missing. Same goes for planetary atmospheres, the tail of a comet, asteroids, etc.
Spectrometry also allows us to measure the velocities of celestial bodies, as well as distances on cosmological scales (to galaxies). When an object is moving, the wavelengths of light it gives off is shifted, either towards red (moving away) or towards blue (moving closer). When the emission/absorption lines are offset one way or the other, it is possible to tell how fast it is moving relative to us. Since the universe is expanding at an accelerating rate that is known, the redshift on distant galaxies can be translated via the hubble constant to a distance. This plays a part in measuring the size of the universe.
A: Spectrometers are able to detect light intensity versus frequency. This is important because objects emit or reflect light based on their composition and energy levels. Hot objects emit light on specific wavelengths based on what, chemically, is hot. Cold objects reflect or absorb objects based on what is doing the absorbing. By measuring these frequency/intensity pairs we gain information about what an object is made of. If we know the spectrum of the illuminating source, we can observe the changes in the reflected light to better understand what did the reflecting.
Spectrometers aren't just for visible light either. A Mössbauer spectroscope measures gamma radiation, and one is on both the Spirit and Opportunity Mars rovers. These were able to determine the concentration of Iron in Martian rocks and soils. This specific device is able to give information not just on specific elemental concentration, but also their crystalline state, which is very useful for geologists.
The Cassini probe has several spectrometers on it, infrared, ultraviolet, and several designed for detecting various species of charged and neutral particles. These have given us a much better view of what makes up the Saturnian system than we've been able to detect from here. Of particular interest are stellar occultations; a background star with a very well understood spectra is observed as something interesting, such as the atmosphere of Titan, passes through the foreground. Events like these can yield extremely useful information.
Just recently the Spitzer telescope made the news about an Olivine rain on a distant star, the instrument that detected this was the spectrometer. Other papers have done work on examining minerals in the habitable zones of planetary disks. If the news breaks that liquid water has been discovered on an extra-solar planet, it will be a spectrometer that makes the discovery. Very useful things.
