What has occurred when sugar is combusted to give a black, tarry residue?
The sugar is incompletely combusted to give elemental carbon, a black sooty substance.
Complete combustion of sugar gives ONLY carbon dioxide and water gases:
This is balanced with respect to mass of charge. If I assume that some of the sugar is incompletely combusted to elemental
Note that this is not just an intellectual exercise only, in that it would not be too hard to measure the products evolved under conditions of incomplete combustion. And if SOME carbon monoxide were evolved we could write...
Note that when we combust hydrocarbon fuels in the internal combustion engine, some of the hydrocarbon fuels are always incompletely combusted to
It is solid Carbon which is soot and is seen as black residue.
It is assumed that sugar crystal referred to in the question are of table sugar with chemical name Sucrose and molecular formula
When you heat sugar crystal in a test tube, first of all water of crystallization will evaporate partly and some crystals will dissolve in it.
On further heating, like most hydrocarbons, the sugar molecules will be burnt in the presence of atmospheric oxygen to form
It should be noted that if heating continues with abundant supply of oxygen, this carbon residue will also burn off and nothing will be left in the test tube.