There are two ways to overcome this problem. One is to use a kind of electric current that periodically reverses direction, which is known as an alternating current (AC). In the kind of small, battery-powered motors we use around the home, a better solution is to add a component called a commutator to the ends of the coil. (Do not worry about the meaningless technical name: this slightly old-fashioned word "commutation" is a bit like the word "commute". It simply means to change back and forth in the same way that commute means to travel back and forth.) In its simplest form, the commutator is a metal ring divided into two separate halves and its job is to reverse the electric current in the coil each time the coil rotates through half a turn. One end of the coil is attached to each half of the commutator. The electric current from the battery connects to the motor electric terminals. These feed electric power into the commutator through a pair of loose connectors called brushes, made either from pieces of graphite (soft carbon similar to pencil "lead") or thin lengths of springy metal, which (as the name suggests) "brush" against the commutator. With the commutator in place, when electricity flows through the circuit, the coil will rotate continually in the same direction.
Occasionally, a technician or service person will ask me, "why not just increase the output by increasing the voltage (the current flow) to the motor?" While that may seem logical, increasing the voltage (in effect, creating an overvoltage situation) will not necessarily boost the output of the device. To understand why, you need to become familiar with a physical characteristic called "hysteresis loss."
Without getting into a lengthy physics lecture, this process of reversing polarity produces heat (or wasted energy). This is known as hysteresis loss. And that helps explain why increasing the voltage into the motor will not necessarily increase the output. Instead, it can fight the resistance of magnetic materials to reverse polarity--and simply heat iron.
If you place the wire near a permanent magnet, this temporary magnetic field interacts with the permanent magnet field. You will know that two magnets placed near one another either attract or repel. In the same way, the temporary magnetism around the wire attracts or repels the permanent magnetism from the magnet, and that is what causes the wire to jump.