An electric motor converts electric energy into mechanical energy that can be used to do work. In the experiment we first use DC current to flow through the wire. Remember that DC current flows in only one direction unless there is a switch to reverse its direction. When the current is first turned on, the like magnetic poles are near each other. Recall from past experiments that like magnetic poles repel each other, and they are forced to move away from each other.
Since the electromagnet is free to move, its south pole moves away from the south pole of the fixed magnet. However, as it rotates it moves closer to the north pole of the fixed magnet and is pulled toward it by an attracting force because unlike magnetic poles attract each other. When we reverse the direction of the current flow, the location of the poles change places, and again, you have two like poles near each other. This arrangement causes the electromagnet to rotate again as the like poles are forced away from each other and the unlike poles attract each other. Then, again, the movement stops until the current is reversed and the magnetic poles in the electromagnet change places another time.