Because the magnetic field reverses direction.
The basic idea of an electric motor is really simple: you put electricity into it at one end and an axle (metal rod) rotates at the other end giving you the power to drive a machine of some kind.
An electric motor is all about magnets and magnetism: A motor uses magnets to create motion. If you have ever played with magnets you know about the fundamental law of ail magnets: opposites attract and likes repel.
So if you have two bar magnets with their ends marked "north" and "south," then the north end of one magnet will attract the south end of the other. On the other hand, the north end of one magnet will repel the north end of the other (and similarly, south will repel south).
Inside an electric motor, these attracting and repelling forces create rotational motion.
To find out more about how does this work in practice and exactly how do you convert electricity into movement, refer to the following links below:
www.explainthatstuff.com - How do electric motors work?
www.pps.k12.or.us - Introduction to How Electric Motors Work