Why Do Magnets Repel?
Magnet has North Pole and South Pole representing the two ends of it. The magnetic force remains concentrated and strong at the poles. If a string is bound at the middle of the magnet and left it free, the North Pole will face the North and its South Pole faces the South direction. Earth is also a big magnet. The magnetic fields of the Earth are strong at the North Pole and South Pole. The like poles in the magnet repel each other and unlike poles attract each other. A magnet when broken into two will again result in two magnets having North and South Poles separately for each of them.
Magnets repel each other when they are placed parallel to one another. They attract each other when placed end to end. The property of magnet can be checked by taking it nearer to the iron filings. If the iron filings are attracted or repelled then the substance under investigation is said to be a magnet. Magnets are found naturally as well as they can be made by us.
The magnetic process happens at the atomic level. Magnets are surrounded by a magnetic field that is not visible to us. This prevails due to the movement of electrons that are surrounding the nucleus of an atom. The activity of the electrons in the magnetic field makes it to attract or repel. Iron, Cobalt, Nickel and Gadolinium are some of the ferromagnetic elements which get attracted to the magnet. They are strongly magnetic as they possess magnetic moments which are generated due to the presence of unpaired electrons in their outer shells. For example, in iron there are 4 electrons in 3d orbital which are unpaired and are responsible for creation of magnetic moment.
Quantum mechanics says that the exchange of photons between the particles of the element is responsible for generation of strong forces like magnetism. If the magnetic moments in the magnet and that of the magnetic substance are parallel to one another then it leads to repulsion.