by Anonick (who blogs here)
The reason for this article is simple: I believe it's important to understand, especially for people who use new technology, how it actually works. Especially in the correct interpretation of any result using the new technology, its pure-science basis plays an important part. To streamline the flow of the post, I might have to place detailed explanations in the sidebar. Do consult the sidebar if those questions pique your interest. The Glossary is also situated there.
OK, to start with, MRI is short for Magnetic Resonance Imaging. Now what does Magnetic have to do with our body? The answer is simple: most molecules and atoms have a tiny magnetic moment, which means they're like tiny magnets . What is important for us is the fact that the nucleus (and hence also a proton) also have a magnetic moment. Just like a magnet affects other magnets, if we can produce a huge magnetic field, we might be able to affect these tiny magnets and potentially detect something.
Now, we only have to understand what a small magnet does when it is placed in a magnetic field. If the magnetic field is constant in time, the magnet just aligns itself in the direction of the field . The magnetic field the MRI magnets induce is of a different kind: there is a component in one direction which is large and constant, while the "transverse" component oscillates in time.  What happens in such a case?
Then what happens in, in simple words: the magnetic dipole doesn't align perfectly along the constant-field direction, but, in response to the oscillating field, it rotates in the same way the transverse component of the field rotates, except that it lags in phase. But it rotates at the same frequency as the applied field. (This might help visualising the precession in a slightly different context. You can relate it to this context by looking at sidenote 3.)
Note that the 'precession' with an oscillating transverse component is not at the natural 'Larmor' frequency, but at the 'induced' frequency, that is, the frequency that the applied transverse field is oscillating at.
So, we've covered the 'Magnetic'. Now for the 'Resonance' part ' (the 'Imaging' will come a bit later). I really haven't come across an explanation of Resonance that is both unmathematical and intuitive, so until I find one, you'll have to take it for granted that: the amplitude of the 'transverse' component magnetic moment is highest when the applied frequency is equal to the natural, or Larmor frequency of the dipole.
But until now we have an isolated atom in a magnetic field that's oscillating in the transverse direction. Now what if we have many atoms, all interacting with one another? Then something you'd normally expect would happen, we can call it "friction". Once you turn the oscillating component of the magnetic field off, the 'transverse' oscillations gradually decay and the dipole becomes aligned in the 'constant' direction.
Why? Because if the dipole is oscillating and interacting with other dipoles, their interactions will exert pushes and pulls on one another that will dissipate energy into the environment, and the eventually all the energy in the oscillations will be gone. This gives rise to a time-scale, that is, there is a time involved in this 'damping', which is a measure of the time it takes for the transverse oscillations to decay down. This only happens after you turn the oscillating component off, though, because otherwise the field supplies the energy which is being dissipated, and thus keeps the dipoles rotating .
Now, it's time to consider one more detail we conveniently glossed over. Even when you apply a constant magnetic field, the dipole doesn't align itself along it: it oscillates, with the 'natural' Larmor frequency, but due to a similar reason to the one above, these oscillations decay, and it becomes aligned along the z-axis. This gives is two time-scales: T1, for the 'constant' component, and T2, for the decay of the transverse ones.  One more thing: T1>T2. 
Ok, we've understood (hopefully) the Magnetic Resonance. But how does this help in Imaging - of all things - the brain?
As a prize for coming so far, and to provide motivation to read ahead, here's a little mid-way summary:
The nuclei of substances are tiny little magnets ('dipoles'), which, when you apply a magnetic field with an oscillating transverse component, oscillate at the applied frequency. Their 'natural' frequency, called the Larmor frequency, determines the amplitude of these oscillations, they being very small if the applied freq is very different from the natural one. However, once you turn off the oscillating part of the applied field, the magnet quickly aligns itself with the constant part of the field with a time period T2. (Where did T1 go? We keep the magnetic field applied for a large enough time that if there were no oscillating part, the dipole would already we aligned with the field.)
Ok, now we have to utilise this in actually Imaging the brain. We're almost there, we need four more pieces of information:
(1) The Larmor (or natural) frequency depends on the strength of the applied magnetic field, and so does T1.
(2) An moving magnetic dipole emits radiation: at the same frequency that it's moving at (ie, about inverse of it's 'characteristic time').
(3) The natural frequency depends on the nucleus under consideration: for protons the formula is different than for, say, Helium nuclei.
(4) There is different concentration of water in different parts of the brain, and in different situations it changes.
Now we're ready to do some detective-style figuring out. Water contains protons (H nuclei). So now if we could just 'tune' our frequencies such that we can select only the H-nuclei... wait a second! If I put my applied frequency close to the H Larmor frequency, then since (hopefully) it is far away from the frequencies of other nuclei, those nuclei might oscillate, but with such a low amplitude that it won't make a difference. So, I can catch the frequencies from the H-atoms only.
Okay, but what do I catch? Well, the oscillations dying out will be moving magnetic dipoles, which will give off radiation (see (2)) at the (radio-)frequencies corresponding to T1 and T2. We can tune at "look" at either signal.
Now I've tuned and I'm looking. How will I know where my signal is coming from? Hmm... look at (1). If I the 'constant' component of my magnetic field is non-uniform, that is, it varies depending on position, then even my T1 will be dependent on position, and by fine-tuning (if I know my theory and my applied magnetic field) I can look at whatever part of the brain I want. (That is, every part of the brain has a slightly different T1 and hence emits radiation at a slightly different frequency.)
What do I see? Different amounts of radiation are emitted from different parts of the brain. That is, the intensity of the signal is different. The intensity, of course, depends on how much of water is there in that part of the brain, which we assume is an indication of the activity going on there (water is a part of blood and of cerebro-spinal fluid, hence etc etc).
You can conduct T1-weighed ot T2-weighed scans, but I am yet to understand the subtle differences between them  (and in fact, the actual Imaging is much more complicated than what I've described, but I'm a theoretical physicist, so do pardon me.)
That, then, is the basic detail of the Imaging: to recapitulate, well, just look at the four points above and deduce.
In conclusion, I've tried to give you a simple (simplistic?) explanation of the physics behind MRI. There is a more complicated type of MRI known as fMRI and much in vogue nowadays, because it's fast (T1 can sometimes be as slow as one second, and then you need to let everything settle.)
References: I have used no equations, and have glossed over many details, but for detailed explanations you need look no further than the Wikipedia articles on Magnetic Resonance Imaging and on Relaxation Time. Also, look here for Magnetic Resonance and here for the MRI article on How Stuff Works (which I don't find very satisfying). And finally, here and here are nice articles on fMRI and MRI physics respectively (they're pdfs).
 And molecules and indeed, atoms too have magnetic moments, but as you'll see below, the frequencies are different, and you can usually 'tune in' to excite only some dipoles (in this case, the nuclei and not the molecules and atoms).
 This whole discussion is couched in classical mechanics. The fact is, it works... that's the beauty of Ehrenfest's theorem, I guess.
 To imagine this, here's a diagram. In the right-hand diagram is what we're imagining, H0 is the constant field, and H1,-1 is the oscillating part (it sort of rotates around in that plane). M is the dipole.
 To the pedant who'll claim here that 'magnetic fields do no work', sure. But it has to come from somewhere, and I suspect Lenz's law plays a part.
 Actually, there is in fact a third time scale that is important in MRI: called T2*. What happens in T2 is affect by an inhomogeneous field (see later), and it's value is reduced to T2*.
 T1 is due to interactions of the dipole with the lattice, or the macroscopic fluid, and T2 is due to 'friction' with the neighbouring dipoles.
 Also, T2 depends on the concentration too (since it depends on interactions with neighbouring dipoles). This might potentially affect the signals.
And finally, a Glossary:
Magnetic Moment: Um, the quality that makes a magnet a magnet. A larger magnetic moment means a "stronger" magnet. It's pointed from S to N (of the magnet).
Dipole: Well, the quality of being a tiny magnet, in the roughest terms. The dipole moment is a measure of the strength of the tiny dipole.
Larmor Frequency: The natural frequency of a dipole, which is it's frequency of oscillation when there's a constant magnetic field.
Precession: The motion the dipole performs in an external field. See the diagram linked from the text.
Resonance: The phenomenon that the amplitude (not frequency) of the oscillation is highest when the external frequency is equal to the natural frequency of the oscillator.
(c) 2009 Anonick