In an electric motor, HOW does the magnetic field FLIP?

Normally, in permanent magnet electric motors, it does not. What happens is the magnetic field being created by current through a armature switch reverses direction.

http://hyperphysics.phy-astr.gsu.edu/Hbase/magnetic/motdc.html