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.
Another interesting design is the brushless DC (BLDC) motor. The stator and rotor effectively swap over, with multiple iron coils static at the center and the permanent magnet rotating around them, and the commutator and brushes are replaced by an electronic circuit. You can read more in our main article on hub motors. Stepper motors, which turn around through precisely controlled angles, are a variation of brushless DC motors.
One way to overcome this situation is by using "magnetically soft" material. Magnetically soft material has atoms that readily reverse polarity (a docile herd?) when exposed to alternating current. Naturally, since the reversing process happens more quickly, there is less wasted energy.
If you are confused by me saying that the current flows from positive to negative, that just happens to be a historical convention. People like Benjamin Franklin, who helped figure out the mystery of electricity back in the 18th century, believed it was a flow of positive charges, so it flowed from positive to negative. We call this idea conventional current and still use it to this day in things like Fleming Left-Hand Rule.