Stars - large or small, alive or dead, quiescent or exploding - are the fundamental engines behind the cosmic enrichment cycle of elements. Slowly but steady, through generation after generation, the stardust that we all are made of has been accumulated since the dawn of cosmic time. This process can be studied by highly dispersed stellar spectra, in which the strengths and shapes of absorption lines help us unravel the chemical composition of these luminous balls of gas. Starlight escapes from a thin layer at the stellar surface - the stellar atmosphere - which for solar-type stars is characterized by convective cells, thousands of degrees hot, constantly appearing and disappearing. Through the light-collecting power of large telescopes and multiplexing capabilities of new spectrographs, millions of stars in our Galaxy and its smaller satellite galaxies can be studied in great detail. Deciphering the stellar spectra in terms of chemical abundances is however highly non-trivial and requires accurate models of the physical conditions and energy transport throughout the atmosphere. Equipped with cutting-edge observations and theoretical models, stellar spectroscopy can unravel not only the origin of elements, but also the formation and evolution of individual stars, of star clusters, and even of entire galaxies.