What are magnets, how do they form, how do they attract and repel?
Any charged particle has associated with it an electric field. Once a charged particle begins to move then it also sets up a magnetic field around itself that is perpendicular to both the direction of motion and the electric field.
Any moving charged particle with it's own magnetic field will experience a force due to the first moving charged particle and vice versa. This is the magnetic force.
Bar magnets are a special case as they don't seem to be moving, but the electrons inside the individual atoms are moving. Usually they are moving round in random directions but the theory goes that in a bar magnet the electrons all line up and so rather than the total magnetic field adding up to 0, the magnetic forces of all of the moving charged particles builds up to form a more noticable magnetic field. (At least that's how it was explained to me.)
Does this description help at all?
It is important to emphasize that only certain elements can form "permanent" magnets. Iron is the chief among these and most permanent magnets are mostly composed of iron. The very strong ferro-ceramic magnets that are at the heart of an audio speaker are an example of this.
Other elements that can be made into permanent magnets are nickle, cobalt, and the "rare earth" elements. (Strangely enough, single atoms of aluminum can become magnets, but this property is offset when two or more aluminum atoms are joined together.) Permanent magnets made from an alloy of aluminum, nickle and cobalt Alnico make very strong permanent magnets.
The reason that magnets can only be made from this small set of elements is that it is only these who have one or more electrons in their orbits with an "uncompensated spin". In all other elements the "spin" of all the electrons is "compensated". It is ony the electric field from these "uncompensated" electrons that contributes to the magnetic field.
Someone who understands the phenomenon of an uncompensated spin will have to jump in here and explain it, because I'm not sure what it means.
The point is that iron, nickle, cobalt, etc have these electrons with an "uncompensated spin" which are able to contribute their electric field to the greater phenomenon of a magnetic field when these elements are prepared in the right manner.
Magnets form in Nature from the mineral Magnetite which is one of the oxides of iron that is easily produced by heating iron red hot or hotter and letting it react with the O2 in the air. This would happen whenever iron were ejected in molten form from a volcano. As it cooled it would simply pick up a magnetic orientation from the earth's magnetic field. The common name for rock like this when it is found in nature is lodestone.
Separate names with a comma.