Combustion is ultimately a chemical reaction, and like any chemical reaction, it requires the right balance of ingredients. The only way to completely exhaust the reaction is to have the perfect amount of fuel (i.e. stuff to burn) and oxidizer (i.e. oxygen). When those ratios don’t match, the reaction can slow down or even appear to end, but that doesn’t mean a fire’s gone out.
Firefighters face one of the dangerous consequences of this situation in the form of backdrafts. When a fire has been burning in a sealed container and exhausted its oxygen supply, it can get extremely hot even if the flames seem to have died down. When oxygen is added back by opening a door or window, the fire can react explosively, as the Slow Mo Guys demonstrate above. The good news is that backdrafts are relatively rare and there are steps you can take to avoid them. (Image and video credit: The Slow Mo Guys)