Magnet
Magnets are strange pieces of matter. A magnet will attract (or be attracted to) anything made out of iron. A magnet will also attract or repel another magnet.
A magnet contains particles called 'dipoles'. In fact lots of materials contain dipoles, but most of the time they are distributed randomly inside the material so no external effects are visible. A dipole is like a tiny little magnet (on a molecular scale), and when you line a lot of those molecular little magnets up one behind the other, positive pole of the one 'touching' the negative pole of the next (and so on) then you will find yourself with a magnet.
Inside the 'dipole', which is pretty much the most basic magnet there is things are pretty complicated. Electrons spin around their respective atomic nuclei, and thes spinning electrons (effectively a very small current) causes a tiny magnetic field. In most molecules/composites these spins cancel out, but sometimes they line up and you get a molecule that has a preferred 'north' and a preferred 'south' side (depending on whether the 'spin' is one way or the other when viewed head on).
Even then you still have to line these dipoles up to get a useable magnet.
# How does a magnet form ?
There are several kinds of magnets:
* Natural magnets
Natural magnets are 'stones' found in nature that usually contain a percentage of magnetite. This is commonly known as 'lodestone'. This was the first 'clue' that magnetism exists, a lodestone hung from a string or placed on a piece of wood in a dish with a liquid would indicate magnetic north. That was the birth of the compass. For a long time this was treated like 'magic' and a highly guarded secret of the 'mages', I don't know if there is any connection with the name ''magnet' but that might be worth investigating.
* Electro Magnets
Electro magnets are magnets that exist only as long as there is current running through them. Any electric current creates a magnetic field at right angles to the current. I have no simple explanation for how this comes to pass - that's another way to say that I don't know how that works I guess, if I did fully understand it then I could explain it :). Electromagnets can be made easily by wrapping some wire (thin wire, lots of turns) around a nail, and then connecting a 9V battery. As soon as you connect the battery the nail will become magnetic. If you reverse the polarity on the battery the nail's magnetic poles will reverse too!
* Artificial magnets
Soon after the discovery of the natural magnet people started noticing weird effects. Somehow the magnetism could be 'passed on' from a magnetic object to some non magnetic objects, usually made of iron. These were the first artificial magnets. What happens during the 'transfer' is that the iron particles are lined up in a specific way, aligning their dipoles resulting in a net magnetic field.
Nowadays we can make VERY strong artificial magnets, such as Cobalt (or rare earth), Ceramic and Neodymium,Iron,Boron magnets (or neos for short). The neos are made as non-magnetic blanks that are then magnetized using tremendously strong electromagnets.
# Why do magnets attract ?
Magnets attract because they have two poles, one north pole and one southpole (hence the name 'dipole', 'di' is a fancy way of saying 'two'. Each of these poles has it's electrons spinning 'clockwise' or 'counterclockwise' as viewed from 'head on', and if these spins are aligned then there will be no problem in getting them together (in fact they WANT to be together), all those tiny little magnets pulling together form a force that you can easily feel with your hands. If you reverse one of the magnets then they will repel.
A bad analogy is to try to push together two turning wheels. If they are turning the same way (and spinning equally fast) then you can push them together easily. But if they are spinning counter to each other then you will be thrown off as soon as the wheels touch.
Since magnets are quite special it is hard to find good 'real world' analogies that help to explain their 'magical' behaviour, this is the best I can do, feel free to add to this article !