Magnetism:
It is a result of electrons spinning on their own axis around the nucleus.
Figure: Electron Spinning Around Nucleus Produces Magnetic Field
Within magnetic materials, the atoms have certain areas known as domains. These domains are aligned like that their electrons tend to spin in the similar direction that was show in the figure.
Figure: Magnetic Domains
The alignment of these domains results in the formation of magnetic poles at every end of the magnet. These poles are known as the North Pole and the South Pole. The law of magnetism states which is like magnetic poles repel and unlike magnetic poles attract one another show in the below figure.
Figure: The Law of Magnetic Attraction and Repulsion