Here’s a pretty awesome chemistry demo that shows how liquid oxygen is actually attracted to magnets.
Each orbital in an atom can fit two electrons, but they have to have a different “spin”. But all orbitals in a subshell must have at least one electron before the electrons start to pair up in orbitals.
This is how magnets work.
Oxygen has two electrons which are alone in their orbitals, this would give it the potential to react due to a magnetic field because the unpaired electrons will react to it– but it’s not quite that simple.
Fortunately for us, oxygen atoms aren’t just flying around by themselves. If that were the case, they’d probably melt your face off. Free oxygen atoms will rip electrons off of other atoms, breaking their current bonds and tearing things apart. A lone oxygen atom is a “free radical.” The process in which oxygen (and other elements) grab electrons is called “oxidation”. (That’s why we call compounds anti-oxidants when they’re protective against free-radicals.)
Oxygen in the air around us, in its natural state, is diatomic. The vast majority of oxygen atoms are bound to another oxygen atom. In the most common state of this bonding, there are two electrons still hanging around unpaired–not enough to melt your face off, but enough for the oxygen to feel a magnetic field (Note: the face-ripping and the magnetic field response are caused by different phenomena, just in case it looks like I’m implying they’re the same thing there.)
The two electrons labeled in red there cause the oxygen to “feel” the magnetic field and stick to a magnet.
Let’s look at Nitrogen. Its electron configuration makes it look like it should be really sensitive to a magnetic field. Look at those three unpaired electrons.
Nitrogen is the most abundant element in our air. It’s flying around all over the place, but not like that. It’s also “diatomic”, that is–each nitrogen molecule also bonds with another nitrogen in its natural state.
Above is the Lewis structure of nitrogen gas. The three lines are bonds (2 electrons each) and the dots are one electron each, but notice there’s a pair of dots on each side. Those electrons roughly cancel each others’ spin and will cause the nitrogen gas to be diamagnetic–not attracted by the magnetic field.
Here’s another really good demo of this same effect. In this one, you can really see the oxygen sticking to the magnets:
Magnetism is fun. Just don’t screw around with the magnets you get out of hard drives. They’ll pinch your damn skin right off.