NMR spectroscopy involves placing a sample in a strong magnetic field and irradiating it with radiofrequency pulses. Certain atomic nuclei absorb these pulses and re-emit them, creating a signal that is detected and transformed into a spectrum. This spectrum provides information about the molecular structure, including the identity and environment of the atoms.