Motors convert electrical energy into kinetic energy, along with some unwanted sound and heat energy.
A simple motor, which can run on d.c. electricity, has a rotor coil and permanent field magnets. As the rotor coil spins, the direction of the current flowing in the coil is reversed by means of a split-ring commutator. Carbon brushes allow the commutator to slide whilst maintaining an electrical connection. Carbon brushes are used as carbon is a good conductor and is hard-wearing.
In commercial motors, the permanent field magnets are replaced with electromagnets called field coils. This allows a more powerful magnetic field to be created than would be possible using permanent magnets. Also, the single rotor coil of the simple motor is replaced by a number of rotor coils (called a multi-coil or armature) and a segmented commutator replaces the split ring commutator. Each coil of the armature is connected to a pair of contacts in the segmented commutator. This allows for a smoother rotation of the motor. Note that in a commercial motor, because the magnetic field is produced by electromagnets, the motor will work equally well with a.c. or d.c. electricity. This is because a reverse current in the field coil will coincide with a reversal in the armature current. Therefore the armature will be forced round in the same direction.
To read more about how motors work, try "How Stuff Works"