I have seen (and used) recipes for icing and glaze that use uncooked milk in them, yet they do not need to be refrigerated. (For example, one with powdered sugar, milk, vanilla and butter or shortening.) If I just left out a cup of milk, it would spoil. Is the sugar chemically changing the milk in some way so it does not spoil?
Microbes need available water to grow, and sugar reduces the availability of water to them. In addition, spread as a thin layer on cake, water evaporates (further reducing water availability).
You can find out more about factors influencing microbial growth in the FDA's Bad Bug Book.
As the book notes, generally, you can only know from experiment if a particular recipe is safe, and also that often they're just slowed not stopped. So it'd probably be prudent to minimize the amount of time you store your icing/glaze.
It is called crenation. Basically, the sugar acts as a super concentrated solution and pulls the fluid from the milk. When it does this, it also pulls fluid from any bacteria which may cause spoilage. Essentially, killing the bacteria through osmosis.