Seriously. That shit keeps me up at night. If someone can explain it, you'll take a load off my mind.
If you're talking about magnets then, from what I can gather, its about the structure of the molecules. This is based off of a theory that I learned recently, so I'm not sure how accurate it is, but it has to do with the electron structure and the orbitals being filled. If the orbitals are completely filled. which would mean the electrons are all paired up, then it won't have a magnetic attraction (called diamagnetic) and if it has free electrons then it will have some sort of magnetic attraction (called paramagnetic). An example would be water having an electric charge. It is an O atom with 2 H atoms bonded to it. It has 2 pairs of free electrons which would make the steric number 4. So say that that gives you 4 "boxes", each of which holds e electrons. For electrons to go in the H atoms contribute 1 electron to hybridization and the lone electron pairs contribute 2 each. You fill in the boxes in such a way that you would have 2 boxes filled and 2 boxes with one each, leaving lone electrons. This leaves a dipole moment that could cause a water molecule to bond to other things, but also gives it a charge and creates magnetism.
Here is a picture of the water molecule
Heres a picture of a strong magnet in action, tearing water apart.
Sorry the explaination is weird or off at some points. I would have tried to explain it with what magnets are made of, but electron structure has so many exceptions further down the table, I'm not even completely sure I explained the water molecule correctly but you might get the gist of it. If I'm wrong, point it out and we'll try to get this shit straightened out.