When an electric current passes through a conductor a magnetic field is created around it and if we place that conductor in a region of fixed magnetic field, the conductor will be subjected to an electromagnetic force causing its displacement. Thus, the principle of operation of an electric motor arises.
We can understand how a motor works by describing that: if you created a simple electromagnet by wrapping 100 turns of wire on a nail and connected 192107.00 leeson the ends of the wire to a pile, the nail would turn into a magnet that has a north pole and a pole the battery is connected.
Now pick up your electromagnet made with a nail, thread a shaft in the middle of the nail and suspend it in the middle of a horseshoe magnet. By connecting a battery to the electromagnet so that the north pole appears, the basic law of magnetism says that the north pole of the electromagnet will be repelled by the north pole of the horseshoe magnet and attracted by the south pole of the horseshoe magnet. The same thing will happen with the south pole of the electromagnet. The nail will move half a turn and park. The armor takes the place of the nail in an electric motor.