Smoke and gas are released by the initial fire in your fireplace. Flue gas consists of steam, and vaporized but unburned carbon based by-products (vaporized creosote). As gases exits the fireplace, it drafts upward into the relatively cool flue where condensation occurs. Like hot breath on a cold surface, the cool surface temperature of the flue causes the carbon particles in the warm vapor to solidify. The actual cause of creosote condensation, is the surface temperature of the flue in which the flue gas comes in contact. This resulting carbon based condensation which materializes inside the flue is creosote. It can be the fine black dust called 1st stage creosote, 2nd stage , which is porous and crunchy, 3rd stage which is tar-like ( drippy and sticky until it hardens into a shiny glaze)
All forms of creosote can occur in one chimney system. Whatever form it takes, creosote is highly combustible. If it builds up in sufficient quantities - and ignites inside the chimney flue and the end result is a chimney fire.
For More Info:
This is where, you actually start your fire.
A firebox, could be made from fire brick, steel, or be a prefabricated manufactured firebox, with "refractory panel" sides.
This is the "exhaust pipe" that is inside your chimney chase.
A chimney flue can be made from terra cotta tile or stainless steel pipe. In cases of older homes, builders would parge the brick walls with mortar, to make a smooth surface.
The damper door is a cast iron, or steel plate, with an axle, that can be opened and closed. It is used to block off the firebox from the flue, when the fireplace is not in use. This helps in keeping heat and AC in your home.
The chimney cap is a steel lid, usually with a spark arresting screen around it. It allows smoke out of the flue, but keeps birds and rain out.