The basic theory behind NMR is that protons, which spin and have charge, have a magnetic dipole (a north and south pole, like miniature magnets themselves). When protons are subjected to a magnetic field from a very powerful electromagnet, they reorient in the direction of the magnetic field. The reorientation causes them to release radio waves, which can be detected.