When sugar cooks, it caramelizes. This process, brought on by heat, takes the sugar from a solid, crystalline state to a liquid, and moves it through several stages (thread, ball, crack) until it changes color to amber, golden deep brown, and eventually black (if you’re not paying attention).
The process is always the same, whether you are cooking straight sugar into a syrup, cooking onions down to release their natural sugars, baking a sweet dough loaded with sugar, or burning the top of a crème brûlée.
In addition to adding sweetness, sugar added to dough, sautés, and even marinades promotes the browning of those foods.
Care should be taken when caramelizing, so as not to let the coloration go too far. Burnt sugar is horribly bitter, and downright inedible (unless you’re a weirdy). The caramelization of fruits and vegetables should be done slowly and with patience. Too fast often results in burnt and uneven caramelization. Carrots, beets, onions (and their relatives) all have tons of natural sugar, and really change their character when caramelized.
Watch out, too, for foods with excess starch. Potatoes that are chilled have transformed their starch into sugar, which will burn quickly. This is often seen in deep-fried chips and fries. Be sure to keep potatoes at room temperature to avoid this mishap.
Above all, don’t be intimidated by caramelization. It’s worth the time and care!