The fact that a magnetic field exerts a torque on a current loop can be exploited to make a motor. Current is fed through a loop that is in a magnetic field, making the loop spin. Electrical energy is converted into mechanical energy.
If the current always went the same way around the loop the torque would be clockwise for half a revolution and counter-clockwise during the other half. To keep the torque (and the rotation of the loop) going the same way, a DC motor usually has a "split-ring commutator" that reverses the current every half rotation.