Groups of atoms oscillate at a specific frequencies, providing a tell-tale sign of the number and location of electrons each contains.
This is not strictly true; NMR works by flipping the nuclear spin on unpaired protons in the atomic nucleus (hence the 'N' for 'nuclear' in 'NMR' - which is also why the same technology used in the medical field is called 'MRI', because the 'N' bit sounds scary to patients).
Normally, the nuclei of atoms are oriented in space in random directions, but in the presence of a strong magnetic field (and these things contain very strong superconducting magnets), it is energetically favourable for nuclei containing unpaired protons to line up with the field. Pulsing the sample with a radio-frequency burst (typically in the hundreds of MHz depending on the field strength) gives the nuclei enough energy to spin freely. They can then re-emit radio frequency photons to settl back into field alignment, which is what is measured by the spectrometer. The type of nucleus and environment it is in (other nearby atoms bonded to it) affect the frequency of those radio photons.
Atoms with an even number of protons (such as carbon and oxygen) don't give any signal at all because the protons go round in pairs with their spin aligned opposite to each other, efectively cancelling each other's spin, and therfore not lining up with the field. It is also why expensive solvents containing deuterium, rather than hydrogen (such as heavy water) are used for samples, otherwise the signal from the solvent swamps the signal you are actually interested in. In most organic samples, NMR is only looking at the hydrogen atoms, although IIRC, compounds with nitrgoen or phosphorus can give more complex spectra.
So, the tl;dr; is that NMR gives information about protons, not electrons. Although the electron density of nearby atoms can shift the signal to a lower frequency (known as down-field shifting), the interesting signals come from 'coupling' between other nearby atoms with odd numbers of protons, which splits single peaks into patterns of multiples.