When making candy, it is necessary to raise the temperature of a sugar and water mixture to well above 212° F before enough water boils out of the mixture to produce hard sugar rather than syrupy mixtures. Or put another way, AFAIK in ordinary conditions syrup will never dry out at room temperature. So why does solid crystalline sugar sold in paper sacks not spontaneously absorb moisture from the air and eventually turn syrupy?
Not sure if this gives the information you seek or not. The idea is that you are not boiling water out; you are creating a supersaturated solution which will crystalize out as it cools. HOW it cools is the difference between rock candy to fudge to cotton candy.
That’s an important distinction I hadn’t realized, thanks.
I don’t know the details of treating sugar, but I did once observe a hardened sugar "plaque’ that was made as part of a cake. After the cake had been eaten, the hard, solid plaque was taken and put aside as sort of a memento or trophy. It eventually sort of “ran” in a slow-motion flow. I saw this happen over time – the plaque was not doused with water or anything. I think it simply flowed the way that people (mistakenly) think that glass as a supercooled liquid flows. I suspect that the apparently solid sugar was absorbing water from humid air that enabled it to do this, but I don’t know.
Moral: those apparently solid sugar plaques made of sugar won’t keep. You might as well eat them.
In my experience, a concentrated sugar solution kept long enough at room temperature will dry out enough (Especially it the temp fluctuates) that a little of the sugar will crystalize out. I buy large bottles of maple syrup, and “can” most of it in smaller bottles, and keep a smallish jug of it in the fridge for regular use. (If you leave an un-canned jug on the counter, it will eventually mold.) I refill the smaller jug as it runs out. And every so often, I need to remove the crystals of solid sugar from the bottom of the jug.
And on the flip side, if you keep hard candy around long enough in a humid environment, it will get sticky on the surface.
So I think it’s mostly a matter of time either way.
Related bit about the difference between brown and plain white sugar which has to do with the second part of the op.
Regular sugar cakes and lumps because it is absorbing moisture from a relatively humid environment creating a sugar syrup on the individual crystal surfaces which sticks them together as the humidity lowers enough to dry it out. You keep it from caking by keeping it in a consistently dry environment. The syrup formation is only on the surfaces though.
Brown sugar (fresh) has a coating of molasses on each crystal which is slippery so the crystals slide over each other easily. For brown sugar the issue is that that syrup loses enough moisture that it becomes more viscous, glueing the crystals together.