How does a direct current motor work?
current flows through a wire
there is a magnetic field around a wire
there is a magnetic field around the permanent magnet
the magnetic field also exert an equal and opposite force which moves a wire
There is a split ring commutator that ensures one side of the wire moves up and down which rotates in the same direction
The split ring commutator swaps direction every half turn