An electric motor is a machine that converts electrical energy into mechanical energy, causing movement. They operate on the principle of electromagnetism. When current flows through a conductor, a magnetic flux is generated around that conductor. A magnetic flux also exists between the north and south poles of a permanent magnet. When these two fluxes are allowed to interact, i.e. the current carrying coil called armature is placed in a magnetic field, the armature would react in the same way that another magnet would. This results in rotation of the armature.
Most simple motors use the DC current. When a current passes through the armature, it becomes an electromagnet. The armature turns to line up its two poles with the opposite poles of the field magnet, the direction of which can be obtained from Fleming’s left hand rule. As soon as the poles align, the armature would stop turning, but the direction of the current is then reversed, with the help of a commutator, reversing the polarity of the electromagnet in armature. Because the poles in the field magnet and those in the armature are now alike, they must repel to make another half-turn in the same direction. The current in the armature reverses again, and again the armature turns another half-circle. Thus, the armature keeps on turning as long as the current is passed through it, and is reversed at the right moment every half-turn.