The process begins with the incomplete combustion of fuel in the attached appliance, usually a wood or coal stove, or open fire. The unburned volatiles are heated to the vapor state but not consumed due to a lack of adequate heat and oxygen within the appliance. These volatile distillates escape into the chimney, where they contact cooler surfaces and condense into tar-like deposits, and soot. Successive layers accumulate until either the chimney plugs completely, or the chimney reaches a temperature and oxygen level at which the deposit will ignite. Due to the concentrated level of volatile material now present, these fires tend to burn very hot.
Alternatively, a chimney fire may be caused by old bird's nests which have fallen into the chimney and lodged there. When a hot ember ignites the nests, the fire can be just as serious as one caused by ignition of soot. In very old houses, the chimney may also be very large and thick enough to withstand the fire.
The high temperatures may affect the strength of the chimney causing distortion of metal structures, and potential failure of ceramic structures.
Causes of the deposits which lead to chimney fires include using green/wet fuels, the operation of appliances with insufficient air intake, and low operating temperatures for prolonged periods followed by hot fires. Such practice typically occurs when mild weather periods are followed by cold snaps.
There are several major issues that are at risk from a chimney fire event. There is of course the danger of burning debris being expelled from the top of the chimney that could ignite other portions of the structure, but the major cause of damage is where the heat of the chimney fire will pass through the masonry materials and overheat nearby combustibles. Even though codes and standards require a specific clearance of the framing members from the masonry materials, often this is not found in actual construction. Many fires reported as chimney fires, are actually structure fires ignited by the overheating of the framing members. These structure fires can be traced to the normal use of the fireplace or sealed combustion chamber.
Steps to prevent this buildup of deposits include only running appliances hot during the initial ignition phase regularly, only building short and hotter fires, regular cleaning of flues using a chimney sweep, and only using internal chimney structures where possible versus a chimney attached to an external wall. The latter tends to be cooler, contributing to the problem, as well as creating downdrafts which tend to introduce smoke into the structure as the fire subsides. The nests of birds can be prevented by using a wire guard over the chimney.
Control includes denial of oxygen, addition of extinguishing agents, and removing heat sources. In case of chimney fire, the local fire department should be called immediately: there is a risk of the chimney failing, and/or overheating adjoining structures, which could cause the fire to spread to other parts of the building. Additional hazards include the possible buildup of toxic gases such as carbon monoxide within the structure due to restricted flues. 
|Wikimedia Commons has media related to Chimney Fire.|