Nuclear magnetic resonance (NMR) is based upon the property of some atomic nuclei called spin. These nuclei behave as if they were magnets.
When a molecule is placed in a magnetic field, its electrons respond with motions that tend to counteract that imposed field. In such a situation, a nucleus 'feels' a magnetic field that results from the imposed field less what the electrons create in response to that imposed field. The nucleus's response to imposed radiation, then, depends upon its 'chemical environment' -- it depends on the nature of the distribution of nearby electrons. Nmr, then, is a means of determining structures.
Nuclei that have either an odd number of protons or and odd number of neutrons behave like magnets.