>>48878312Electrons in an atom are arranged in levels. Without going into too much specifics, these levels are split up into orbitals, each being able to hold two electrons which spin in opposite directions. These orbitals fill up with one electron at a time, all with the same direction of spin. So, in a level with five orbitals, the first five electrons will fill up one orbital each spinning one way, then the sixth electron will go back to fill up the first orbital spinning the other way, and so on. When you have atoms with electrons of all unpaired, parallel spins, that atom is paramagnetic, and can be attracted by a magnet.
That's just what I remember from Intro to Chem, it might be a bit off.