The radio waves that are sent into the sample placed in the magnetic field, are of the resonance frequency (also called teh lamour frequency) of the hydrogen nuclei, this forces some of them to achieve the higher energy state ("flip")
MRI uses the frequency that matches the natural frequency of the Hydrogen atom to excite it to higher energy state. And they will align to the magnetic field (or sth) When the scanner is turned off, the excited hydrogen atom will re-radiate out the excess energy in the form of radiation (scanners picks it up) to fall back to it's original level.