A simple direct current (DC) motor is illustrated below.
The motor features a permanent horseshoe magnet (called the stator because it’s fixed in place) and an turning coil of wire called an armature (or rotor, because it rotates). The armature, carrying current provided by the battery, is an electromagnet, because a current-carrying wire generates a magnetic field; invisible magnetic field lines are circulating all around the wire of the armature.
The key to producing motion is positioning the electromagnet within the magnetic field of the permanent magnet (its field runs from its north to south poles). The armature experiences a force described by the left hand rule. This interplay of magnetic fields and moving charged particles (the electrons in the current) results in the torque (depicted by the green arrows) that makes the armature spin. Use the Flip Battery button to see what happens when the flow of current is reversed. Take advantage of the Applet Speed slider and Pause button to visualize these forces better.
A single, 180-degree turn is all you would get out of this motor if it weren't for the split-ring commutator — the circular metal device split into halves (shown here in red and blue) that connects the armature to the circuit. Electricity flows from the positive terminal of the battery through the circuit, passes through a copper brush to the commutator, then to the armature. But this flow is reversed midway through every full rotation, thanks to the two gaps in the commutator. This is a clever trick: For the first half of every rotation, current flows into the armature via the blue portion of the commutator, causing current to flow in a specific direction (indicated by the black arrows). For the second half of the rotation, though, electricity enters through the red half of the commutator, causing current to flow into and through the armature in the opposite direction. This constant reversal essentially turns the battery's DC power supply into alternating current, allowing the armature to experience torque in the right direction at the right time to keep it spinning.