How permanent magnets work?Are they working with motion of electrons? Are they working with motion of electrons?
 A: Sub-atomic particles such as electrons, protons, and neutrons (and many others) have a fundamental quantity called a spin angular moment. For an electron it is $\hslash/2$. This spin gives rise to a small magnetic moment for the electron. Despite the name, we don't think the electrons (or other particles) are spinning around an axis through their center like an everyday top. The spin is understood to be a fundamental property like mass or charge. 
Every bound electron in an atom also "orbits" the nucleus. And this orbital motion gives it an orbital angular moment which also gives rise to the orbital magnetic moment. Together, the total magnetic moment of the electron gives the atom its magnetic character. In atoms with full or nearly full shells (i.e., those elements that occur at the edges of the periodic table blocks) these electrons pair up and cancel the net magnetic moment. However, for elements in the middle of the periodic table blocks where atoms have half-full shells the spins don't cancel out and the atoms retain the spin magnetic moment of the electrons in the outermost half full shell.
Now, when the atoms assemble in a nice crystal once again these moments can either cancel out or add up and amplify depending upon how these atoms are aligned relative to each other. That is where magnetic domains come into the picture. Roughly speaking, a magnetic domain is a region in the solid where the atomic magnetic moments do not cancel each other out and are approximately aligned parallel to each other. When the domains are of roughly the same size, neither one has a strong influence on the other and the overall solid remains weakly magnetic. However, in the presence of a strong magnetic field, the domains can get aligned parallel to the magnetic field. This makes the overall solid a permanent magnet. 
An iron bar left sufficiently long near a magnet "retains" the memory of that magnetic field this way. Crystallized properly, these solids can form very strong magnets too. And magnetic fields need not come from magnets. Because of relativistic length contraction, an electric current produces a magnetic field. These electro-magnets can be used to create industrial strength permanent magnets. To understand how relativity explains magnetism, I encourage you to ask another question.
