Spectroscopy is a technique that involves analyzing the light from celestial objects to determine their composition, temperature, density, and motion. By studying the absorption and emission lines in a spectrum, astrophysicists can infer the presence of specific elements and compounds. The Doppler effect observed in spectral lines also provides information about the velocity of objects relative to Earth.