Motors Are Magnets
You know how one end of a compass needle always points to North. No matter how you turn the compass, the same end of the needle always swings to the North. The earth itself and that small compass are both magnets (Figure 1). Each has a North pole and a South pole. Around the poles of each there are magnetic fields, invisible lines of force that attract and repel.
Figure 1. The same end of the compass needle always points to the earth's magnetic North Pole.
The N poles repel each other and so do the S poles. The N and S poles attract each other. In other words, opposite poles attract; poles that are alike repel each other.
Lay 2 bar magnets on a table side-by-side. If both N poles are at one end, they'll repel each other and almost flip around until there's a N pole lying next to a S pole (Figure 2).
Figure 2. Small bar magnets laid side by side move so that the North pole of one is near the South pole of the other.
Now suppose we place one of the bar magnets on the table. The other, we'll fix on a pivot so it can spin around. This one we'll move so its N pole almost touches the fixed magnet's N pole. As soon as we release it, the movable magnet will spin around so its S pole will be near the N pole of the stationary magnet. That's an electric motor—almost.
Figure 3. A movable bar magnet pivots so its South pole is near the North pole of a stationary magnet.
It's not quite a motor because the rotating magnet will just move as far as it has to in order to get the opposite poles together. You might be able to cause the movable bar magnet to make turn after turn. You could do this by turning the fixed magnet quickly end for end. This wouldn't be very practical as a motor.