Take a look at the following diagram, called the "Fire Triangle"
Oxygen, heat, and fuel are frequently referred to as the "fire triangle." Add in the fourth element, the chemical reaction, and you actually have a fire "tetrahedron." The important thing to remember is: take any of these four things away, and you will not have a fire or the fire will be extinguished.
Essentially, fire extinguishers put out fire by taking away one or more elements of the fire triangle/tetrahedron.
Fire safety, at its most basic, is based upon the principle of keeping fuel sources and ignition sources separate.