All waxes are essentially hydrocarbons, which means they are largely composed of hydrogen (H) and carbon (C) atoms.
When you light a candle, the heat of the flame melts the wax near the wick. This liquid wax is then drawn up the wick by capillary action.
The heat of the flame vaporizes the liquid wax (turns it into a hot gas), and starts to break down the hydrocarbons into molecules of hydrogen and carbon. These vaporized molecules are drawn up into the flame, where they react with oxygen from the air to create heat, light, water vapor (H2O) and carbon dioxide (CO2).
Approximately one-fourth of the energy created by a candle’s combustion is given off as heat radiates from the flame in all directions.
Enough heat is created to radiate back and melt more wax to keep the combustion process going until the fuel is used up or the heat is eliminated.
It takes a few minutes when you first light a candle for this combustion process to stabilize. The flame may flicker or smoke a bit at first, but once the process is stabilized, the flame will burn cleanly and steadily in a quiet teardrop shape, giving off carbon dioxide and water vapor.
A quietly burning candle flame is a very efficient combustion machine. But if the flame gets too little or too much air or fuel, it can flicker or flare and unburned carbon particles (soot) will escape from the flame before they can fully combust.
The wisp of smoke you sometimes see when a candle flickers is actually caused by unburned soot particles that have escaped from the flame due to incomplete combustion.