The ancient Greeks considered fire to be one of the major elements in the universe, along with water, earth and air. But fire isn't really matter. It is a side effect from a chemical reaction between oxygen in the atmosphere and a fuel like wood or gasoline. Extreme heat is needed to bring the fuel to a high enough temperature for it to ignite.
Fire is dangerous because the chemical reactions that cause it keep going. The heat of the flame keeps the fuel at ignition temperature, so it will burn as long as there is fuel and oxygen.
To extinguish a fire, you need to remove heat, oxygen, or fuel. Fire extinguishers can either remove heat by dumping water on the fire, or remove oxygen by smothering the fire with carbon dioxide or a dry chemical foam or powder containing baking soda. (Baking soda will start to decompose from the heat of a fire and release carbon dioxide to smother the flames.)
Flame retardant materials operate on similar principles. Some materials are naturally flame retardant, removing a potential fuel. Those that aren't -- usually fabrics and paints -- can be made so with chemical additives. Flammable fabrics are typically sprayed with a chemical coating that causes an automatic self-extinguishing reaction, while flame-retardant chemicals can be added to most non-metallic paints.
NASCAR racing car drivers incorporate flame-retardant materials into their protective suits. The inner lining of most helmets is made of Nomex, a special fire-retardant material manufactured by DuPont. Driver's suits are made of either Nomex or a similar material called Proban. Such materials protect drivers and crew if there is a flash fire in the pits or a fire is caused by a crash.