How does relativistic electromagnetism explain permanent magnets and the motor effect?

I have spent all day puzzling over this (when I should be revising...) I have just about got my head around how special relativity allows the magnetism to work, and how in different frames of reference this mysterious force acting on a moving charged particle is either electric, magnetic or elements of both, this being the electromagnetic field, unifying both the electric and magnetic elements. I have got to grips with this using the familiar analogy of the positive (lab reference) charged ion and current travelling through the wire, and as the ion moves with the electrons, the length contractions occur, applying an electric force to the ion. So that's all well and good. However I have two main questions, that with hours of scouring the internet I can't find the answer to.

1. How does this idea of relativistic electromagnetism explain why a permanent magnet has a magnetic field? Does the electron "spin" act as a current loop, and how does this create a magnetic field?
2. With both the idea of a magnetic field from a permanent magnet and a current carrying wire, how can this explain the motor/generator effect?

TLDR: How does relativistic electromagnetism explain permanent magnets, and the motor effect?

Many thanks!

EDIT: Thank you for all the replies thus far. I am just hoping to refine my question as it is causing a little confusion.

With the idea that magnetism is a force when a charged article is moving with a current, how does this apply to a permanent magnet? In a permanent magnet, If the electron creates a current loop that is instead moving in a circle, does an outside charge have to be moving at a certain velocity to for length contraction to occur in the atom and therefore the magnetic force exhibited my permanent magnets?

How does this logic of special relativity work with permanent magnets?

And then, later on, how this can all come to together with a current carrying wire and permanent magnets in the motor effect...

• In order to apply the same logic for a current loop, you must consider how the electric and magnetic fields transform in a non-inertial (rotating) frame. This gets nasty very quickly, and leads to a situation where the "electric field" doesn't really act like an electric field anymore. So I wouldn't recommend trying to use that same process here. – probably_someone Apr 2 '18 at 22:50
• That said, what precisely do you mean by "special relativity allows the magnetism to work"? – probably_someone Apr 2 '18 at 22:51
• permanent magnets exhibit ferromagnetism, which is due to spin alignment. See hyperphysics.phy-astr.gsu.edu/hbase/Solids/ferro.html See also en.wikipedia.org/wiki/Ferromagnetism#Origin_of_magnetism – ZeroTheHero Apr 3 '18 at 2:16
• Relativity unites electricity and magnetism, and in the example you show, it happens that a force that is purely electric in one frame is purely magnetic in another. That doesn't mean that in all examples, a force that is purely magnetic in one frame can be made into a force that's purely electric in another frame. – Ben Crowell Apr 3 '18 at 2:40
• Permanent magnetism isn’t explained by relativity. It can’t work without quantum mechanics, see the Bohr-van Leeuwen theorem. – knzhou Apr 3 '18 at 8:27