Why are most atoms magnetic while most solids nonmagnetic? Isolated atoms are magnetic, but a collection of atoms are nonmagnetic. Why cannot the atoms remain magnetic when they are brought close? 
 A: The atoms do remain magnetic.  This is the same situation in describing charge.  Matter is filled with charges but the net charge is zero.  This is because there is as much + as - and on the macro scale they cancel out.  In fact, one can experience multi-pole fields due to the separation of charges.
A couple things contribute to the apparent non-magnetized state of most matter.  The individual atoms, and the elementary particles that make them, may have a weak magnetic moment but they those are distributed randomly throughout the material.  So, again, on the macro scale we do not experience a large magnetic moment.  When exposed to an external field these small magnets will align.  When removed from that field some materials will lose their magnetized state while others will retain it.  Those that retain their alignment make good permanent magnets.   
A: As the other answer says, the atoms that are magnetic when being alone keep being magnetic while brought together.
What happens then? Keep in mind that your solid is at a certain temperature. Temeprature is internal kinetic energy. That internal energy makes the magnetic moments align randomnly. For every bunch of atoms pointing upwards, there will probably be as many atoms pointing downwards, so the net effect is zero. In sum, thermal vibrations make the moments align randmly, which cancels its effect. That's why most solids are not magnetic.
To be honest, all solids are diamagnetic. That means that they align opposite to an applied magnetic field. This is a very weak effect, hardly observable, and it is, roughly, due to Lenz's law.
However, there are some solids where an applied magnetic field can align te magnetic moments. This is paramagnetism. When the field dissapears, the solid becomes non-magnetic again, but the solid is magnetic while the field is applied, because the field is able to align the moments.
Finally, there are materials, called "ferromagnets", like iron, which can be magnetic. They have "regions", called "domains", where all the moments are more or less aligned. Originally, domains can be randomly distributed, so the net effect is 0 again. But if you apply a field, the domains tend to align in the same direction as the applied field, so t becomes magnetic.
But in this case, if you turn off the magnetic field, the domains remain aligned, so the material remains magnetic. That's how permanent magnets are made.
However, if you rise the temperature too much, the thermal movement of the molecules will end up breaking the domains and aligning everything randonly again, hence destroying magnetism.
So those are the main types of magnetism. Hope this helped.
