A wire that carries a current in a magnetic field feels a force. An electric motor uses this to turn a coil of wire that sits between the poles of two magnets. The current goes up one side of the coil and back down the other, so the current flows in opposite directions on the two sides. By Fleming's left-hand rule, the forces on the two sides therefore point in opposite directions: one side is pushed up and the other is pushed down. These two forces make the coil rotate.
Once the coil has turned through a half turn, the side that was pushed up has swapped places with the side that was pushed down. If the current stayed the same, each side would now be pushed back the way it came and the coil would stop and rock backwards and forwards. To prevent this, the ends of the coil are joined to a split-ring commutator. The commutator reverses the direction of the current in the coil every half turn, so the force on each side always acts in the same turning direction and the coil keeps spinning in one direction. Carbon blocks called brushes press against the commutator and carry current to it from the battery or power supply, while letting it spin.
The motor turns faster, and with more turning force, if the current is increased, if a stronger magnetic field is used, or if the coil has more turns of wire. Reversing either the current or the direction of the magnetic field makes the motor spin the opposite way.