So here's how a motor works:
Any moving electric charge feels a force when moving perpendicular to a magnetic field line. By extension, a bunch of moving charges (i.e. electric current) will also feel a force in the same situation. Also, if the current in a wire is reversed, the direction of the force it feels is reversed as well.
So: A loop of current-carrying wire is placed in a magnetic field. Since the current must flow in the wire and then out again, the current flows in two different directions, and thus the forces on the top and bottom of the loop are in opposite directions. Imagine a Pringles can on a table: if you push to the right on the open end, and to the left on the closed end, the can rotates, as does our loop of wire. But (and here is the really clever bit) after one half of a rotation, the direction of the current in the wire is reversed, by means of a stationary contact (this thing is a little hard to explain in text-- I'll maybe come back to it), so the part of the wire (or Pringles can) that was being pushed to the right when it was at the top, is now being pushed to the left when it's on the bottom, so it keeps rotating in the same direction. The wire then makes a half a turn until the current is reversed again, and so on ad infinitum. This simple motor is pretty much the opposite of an AC generator-- the motor turns electrical energy into kinetic energy, while the generator does the reverse.