Wildfires will burn until they no longer have one of the following three things: fuel, oxygen, and an ignition source (heat). Fuel for wildfires is usually the dry debris such as leaves, sticks, needles, and fallen trees which are scattered over the forest floor.
A wildfire will also burn the canopies of healthy, standing trees if the fire is hot enough. Oxygen is present in the atmosphere. An ignition source such as a lightning strike or the flames of an already burning fire will generate more heat and gasses and the fire will continue to ignite any remaining surrounding fuel and cause the fire to spread.