Electric motor designs can vary quite a lot, though in general they have three main parts: a rotor, a stator and a commutator. These three parts use the attractive and repulsive forces of electromagnetism, causing the motor to spin continually as long as it receives a steady flow of electric current.
Motors work through the principles of electromagnetism. If you run electricity through a wire, it creates a magnetic field. If you coil the wire around a rod and run electricity through the wire, it creates a magnetic field around the rod. One end of the rod will have a north magnetic pole and the other will have a south pole. Opposite poles attract one another, like poles repel. When you surround that rod with other magnets, the rod will rotate from the attractive and repulsive forces.
Every electric motor has two essential parts: one stationary, and one that rotates. The stationary part is the stator. Though configurations vary, the stator is most often a permanent magnet or row of magnets lining the edge of the motor casing, which is usually a round plastic drum.
Inserted into the stator is the rotor, usually consisting of copper wire wound into a coil around an axle. When electric current flows through the coil, the resulting magnetic field pushes against the field created by the stator, and makes the axle spin.
The Commutator: Basics
An electric motor has another important component, the commutator, which sits at one end of the coil. It is a metal ring divided into two halves. It reverses the electrical current in the coil each time the coil rotates half a turn. The commutator periodically reverses the current between the rotor and the external circuit, or the battery. This ensures that the ends of coils do not move in opposite directions, and ensures that the axle spins in one direction.
More Commutator: Magnetic Poles
The commutator is necessary because the spinning rotor gets its motion from magnetic attraction and repulsion between the rotor and the stator. To understand this, imagine the motor turning in slow motion. When the rotor rotates to the point where the south pole of the rotor magnet meets the north pole of the stator, the attraction between the two poles will halt the spin in its tracks. To keep the rotor spinning, the commutator reverses the magnet's polarity, so the rotor's south pole becomes the north. The north pole of the rotor and the north pole of the stator then repel each other, forcing the rotor to continue to spin.
Brushes and Terminals
At one end of the motor are the brushes and the terminals. They are at the opposite end from where the rotor exits the motor casing. The brushes send electrical current to the commutator and are typically made of graphite. The terminals are the locations where the battery attaches to the motor and sends the current to spin the rotor.