Magnetic force and current.

Because a wire carrying a current away from you, represented by the black dot, has a magnetic field it will be affected by the magnetic field of a magnet.  The yellow and red boxes represent the ends of the magnet.  The field of the magnet is in green.  The circular magnetic field of the wire is shown.  Notice how at the top the fields are lined up and repelling and at the bottom the fields are opposite and attracting.  The wire, if it can move, feels a force down called the Lorentz force.  This force is perpendicular to both the magnetic field of the magnet and the current of the wire.

Motors

Please open this applet.

http://webphysics.ph.msstate.edu/jc/library/20-3/index.html

An electric motor, is a machine which converts electrical energy into mechanical (rotational or kinetic) energy.  A current causes the coil to rotate mechanically.  For this to occur

In the motor a current is passed through a loop, which is immersed in a magnetic field. A force exists on the top leg of the loop, which pushes the loop left, while a force on the bottom leg of the loop pushes the loop right. The net effect of these forces is to rotate the loop in the direction indicated.  At some point, to keep the loop rotating it is necessary to switch the direction of the current. This is done on this applet when the loop is horizontal.