How is a NMR spectrum obtained? I am reading about NMR, and from what I'm understanding it should give information on the transition energies in the spectrum of the nuclear spin in a magnetic field. 

What I don't understand is how this information is accessed during the experiment. 

The NMR measurement is usually described as: a magnetic field $H_0$ polarizes the sample along a certain direction; then a short pulse of an auxiliary magnetic field alters the direction of the magnetization, which then starts to precess around $H_0$. The changing magnetization induces a current the coils of the NMR machine which is measured and gives the precession frequency. The magnetization gradually aligns with $H_0$, leading to a diminishing current intensity. The decrease in intensity gives the nuclear relaxation rate.

A first question is: is the above description of the measurement correct?

A second question is: How do we extract the information on the energy levels $E_m$, or their separation, from the precession frequency? If not from the precession, how is the energy spectrum obtained?
The description is simplified, but actually fairly accurate. You can find all the details in a specialised NMR book (other general texts usually do not go into much detail).

Quantum mechanically, you can show that the precession frequency (Larmor frequency), denoted $\omega_0$, is related to the energy difference between the up and down spin states of a spin-1/2 nucleus. The energy levels are

$$\begin{align}
E_\alpha &amp;= +\frac{1}{2}\hbar\omega_0 \\
E_\beta &amp;= -\frac{1}{2}\hbar\omega_0 \\
\end{align}$$

and so the transition occurs at the frequency $|E_\beta - E_\alpha|/\hbar = \omega_0$, so if we can identify how much precession is happening at the frequency $\omega_0$, that tells us how strong the corresponding signal should be in the spectrum.

The initial data that you get is in the form of a free induction decay (FID), which plots the amount of detected magnetisation against time. The process of extracting the frequencies from the raw time-domain data is accomplished by a Fourier transform.

Feel free to ask if you would like any part of this to be elaborated. I intentionally did not go into great detail, partly because that is the role of a textbook, but also partly because it can get pretty complicated very quickly.

(There is also a complicated sign convention to do with the definition of $\omega_0$, and different books define it differently. Occasionally the definition even depends on the sign of the gyromagnetic ratio $\gamma$. I would advise to not worry too much about plus/minus signs.)