Electromagnetism

       For every type of speaker, there is a permanent magnet with a coil of wire sitting inside it.

Magnet+Wire
The permanent magnet is there to have a consistent magnetic field.

The wire has electricity moving through it which will cause it to generate a magnetic field of its own.  Unlike the permanent magnet, the wire's magnetic polarity can be changed.  This is done by changing the direction of the current going through the wire. 

By changing the orientation of the magnetic poles, the wire will either be puled toward the permanent magnet or be pushed away from it.  The rapid pushing and pulling is what is used for creating the vibrations of air.
Loop-magnet.jpg
In this picture the north pole is at the top, or in the direction of increasing B.  The south pole is at the bottom, or is the direction of decreasing B.  Changing the direction of current through the loop will change the magnetic field and swap the poles.

The coil inside the speaker is essentially lust a bunch of these loops but connected to make a Solenoid/coil.

B
Solenoid0nI
B = the strength of the magnetic field
µ = permeability constant
n = N/l (the number of loops per unit length)
I = amount of current