A Magnetic Resonance Image (MRI) is a map of the hydrogen nuclei in water and fat. It measures the amount and how their magnetization behaves, both of which depend on the tissue they sit in. The MRI scanner controls a sequence: the timing and strength of the radio pulses and magnetic fields it applies. Different sequences bias the image toward different tissue properties; the property that dominates the contrast is called the image's weighting. A T1-weighted image is bright in fat and white matter where the magnetization recovers quickly after the disturbance, and dark in fluid. A T2-weighted image is bright where the signal fades slowly, which it does in fluid, so the ventricles of the brain, the edema around a tumor and the fluid in a joint all appear white. A typical MRI examination contains several volumes/images of the same anatomy, typically five to ten, each acquired with a different sequence. Which sequences are run, and at what resolution and slice thickness, is decided by each hospital's protocol, so the same examination at different hospitals rarely yields the same set of images. The intensities therefore have no intrinsic meaning: the same tissue takes different values under different sequences and on different scanners.

Left: a T1-weighted brain volume played slice by slice (Hermoye, CC BY-SA 3.0), then an axial T2-weighted slice, in which the cerebrospinal fluid (CSF) in the ventricles is white and gray matter is brighter than white matter (Novaksean, CC BY-SA 4.0). Right pair: one knee in two sequences on the same scanner. T1-weighted, where the fat in the marrow and under the skin is bright; and proton-density-weighted, a sequence that mostly reflects how much hydrogen is present, run with fat suppression, so fat is dark and joint fluid bright (Ptrump16, CC BY-SA 4.0). All from Wikimedia Commons.
MRI is the first choice for many questions where soft tissue has to be told apart from other soft tissue: brain tumors, multiple sclerosis, stroke, the spinal cord, ligaments, cartilage and menisci in joints, the heart muscle, liver and prostate lesions, and supplemental breast screening (2.3 Mammography). It uses no ionizing radiation and gives the best soft-tissue contrast of the common modalities. The downside is that it is expensive, an examination takes 20 to 60 minutes, and the voxel values have no physical unit, unlike the Hounsfield units of 2.4 CT — Computed tomography.
In essence, an MRI scanner measures voltage in a coil of wire. Consider panel a) of the animation below. If you move a magnet past a coil, a voltage appears across it. Hold the magnet still and the voltage is zero. That is Faraday's law of induction, the same principle by which a bicycle dynamo lights a lamp. The detector of an MRI scanner is nothing more than coils of this kind: an array of small loops, 8 to 64 of them in a modern head or body coil (Gruber et al., 2018), each recording its own voltage over time. A loop picks up mostly the tissue nearest to it, but that is not how the image is localized. Where a signal came from is encoded in its frequency. Panel c) shows this along one axis; a full explanation comes later.
a) A magnet passing a coil induces a voltage; at rest it induces nothing. b) Each hydrogen nucleus in the water is a tiny magnet. With no field they point in all directions. In a strong field B₀ they precess around it at f₀, out of step with each other, and a slight majority point along B₀: a small fixed net magnetization, which induces nothing. A radio pulse at f₀ brings them into step and tips the net magnetization; the coil records a voltage oscillating at f₀ that decays as they drift apart again. c) With the field stronger on the right, the protons at x₁ circle more slowly than those at x₂. The coil records the sum, and its Fourier transform has one peak per position: the spectrum is already a 1D picture of where the water is along x.
The body contains gazillions of tiny magnets. Each hydrogen nucleus, a single proton, has a spin and with it a magnetic moment: it behaves as a tiny bar magnet. Water and fat are full of hydrogen; the roughly 40 litres of water in an adult body alone hold about $3\times10^{27}$ of these magnets.
Consider the glass of water in panel b). Left to themselves the proton magnets point in random directions and cancel out. Switch on a strong magnetic field $B_0$ and each proton magnet precesses arout the field direction, like a tilted spinning top, at a frequency set by the field strength. The molecules themselves do not spin; only their nuclear magnets do. More of them line up along $B_0$ than against it, which gives the water a small net magnetization. This does not, however, induce a voltage in the coil: $10^{27}$ magnets precessing out of step add up to a fixed net magnetization along $B_0$. A magnet that stands still does not induce a signal in the coil.
In 1946, Felix Bloch at Stanford and Edward Purcell at Harvard found that a short radio pulse at exactly the precession frequency $f_0$ brings the proton magnets into step and tips the net magnetization away from $B_0$ (called tipping or flipping the magnetization). This is resonance: each push is tiny, but they add up, like pushing a swing at its own rhythm. For a few hundred milliseconds the protons precess together, the tipped net magnetization acts as one rotating magnet and induces a voltage in the coil, until they drift out of step and the signal fades. This is shown in panel b).
Panel c) varies the field strength. Protons in a stronger field circle faster, so two glasses of water (one half full) at positions with different field strength give two frequencies, which the Fourier transform separates. The height of each peak is set by how much water circles at that frequency, so the glass on the right gives the taller peak. Frequency gives position, peak height gives amount. This is the central trick of MRI: the scanner does the Fourier transform physically. Because the field sets each proton's frequency by its position, the voltage $V(t)$ is the Fourier transform of how the water is spread along $x$, and one FFT of $V(t)$ gives that spread back.
Let’s formalize the explanation above. The main field $B_0$ defines the $z$ axis of the scanner, along the patient. A proton in it precesses about $z$ at the Larmor frequency
$$ f_0=\gamma B_0\tag{2.6.1} $$
where $\gamma=42.58$ MHz/T is the gyromagnetic ratio of hydrogen, so $f_0$ is 63.9 MHz at 1.5 T and 127.7 MHz at 3 T, in the VHF radio range (FM radio sits between the two). Equation 2.6.1 sets the frequency the scanner must transmit for a given main field strength $B_0$. The position-dependent shifts that the gradients add later are very small, under 0.1% of $f_0$, so everything the scanner transmits and measures lies in a narrow band around $f_0$.
The effect of a radio pulse in fat (left) and cerebriospinal fluid (right). Each small arrow is one molecule's nuclear magnet (water or fat), drawn at exaggerated tilt. The net magnetization M (black) is the sum of the molecules in the local region. A radio pulse (green) set at the resonance frequency f₀ adds a weak rotating field B₁ which causes the molecules to rotate in sync temporarily. This causes M to drift away from the equilibrium state, and it rotates temporarily. The Mₓᵧ (blue) component is the net rotation, which induces an MR signal in the coil. After the pulse, the molecules drift out of sync and the net magnetization returns to equilibrium where M (black) aligns with the main field.
It’s impossible to measure signals from individual protons, only the local sum (e.g. over a voxel), or the net magnetization $\mathbf{M}$, which we depict as the large black arrow in the animation. At equilibrium $\mathbf{M}$ therefore is non-zero laying along $B_0$, and its magnitude grows proportinoally to the field $B_0$and with the number of protons in the area
$$ M_0 \propto \rho\,B_0 \tag{2.6.2} $$
where $\rho$ is the proton density, the number of hydrogen nuclei per unit volume.
The radio pulse creates a second, much weaker field $B_1$ (green), perpendicular to $B_0$ and rotating at $f_0$. Its small torque accumulates in each hydrogen in step with the existing precession at $f_0$, and the net effect is to flip $\mathbf{M}$ away from the main field direction $z$ by the flip angle $\alpha=2\pi\gamma B_1\tau$, where $B_1$ is the pulse amplitude and $\tau$ is its duration. The animation shows a 90° pulse, which lays $\mathbf{M}$ flat in the $xy$ plane.