An electric motor uses the force on a current-carrying wire in a magnetic field to produce rotation. A coil of wire is placed between the poles of a magnet. The current flows along one side of the coil in one direction and back along the other side in the opposite direction. By Fleming's left-hand rule, the forces on the two sides are in opposite directions, so one side is pushed up and the other is pushed down. The coil turns.
Just past the vertical position, the forces would try to turn the coil back again. A split-ring commutator swaps the connections to the coil every half turn, which reverses the current in the coil. The forces then keep pushing the coil round in the same direction, so it carries on rotating. Carbon brushes press against the commutator to carry current from the supply.
A motor turns faster with a larger current, a stronger magnet or more turns on the coil. Reversing the current, or reversing the field, makes it turn the other way.