To summarize from Hanahan's paper (see below for reference), he carried out a systematic review of conditions necessary to improve transfection efficiency. Among the conditions tested were the presence of various cations (Ca2+, Cs+, Mn2+, K+, Mg2+), DMSO, and growth temperatures (and a few other conditions not so commonly used these days). He worked with a strain that he subsequently isolated a derivative of, called DH1, which is now available commercially as DH1-alpha and other strain derivatives.
He defined transformation efficiency to be the number of transformed colonies on a plate, a measurement still used today. He found when the transforming media contained: certain cations, specifcally Mn2+, Ca2+, Rb+; as well as DTT, hexamine cobalt (III) and DMSO; greatly improved the transfection efficiency compared to the standard Ca2+ treatment. He also found that sucrose and K+ were useful, though not strictly necessary for his experimental strain. It was stated in this paper, though not explained, that sucrose acted as a stabilizer, possibly to guard against his initial use of 0°C incubation and/or freeze/thaw cycling. For the rest of his work, he did not use sucrose.
Among his conclusions, he states that DTT is necessary, as well as di-valent and mono-valent cations, but that they seem to be nonspecific. In other words, there is no strict requirement for having Ca2+, since Mg2+ and Mn2+ perform equally well, nor is there a requirement for K+, though it's admittedly easier to use than Rb+.
There are today a number of "rich" media broths that are available: SOB, SOC (SOB + MgCl2 and sucrose), 2xYT, NZY+, TB, etc. All of these are superior to LB for transformation purposes because of the refined salt balance and in particular the inclusion of these di-valent and mono-valent cations. Sucrose seems to be included for the ease of metabolism and stability of the heat shock process (though I can't find a paper explicitly explaining why it is used, other than tradition).
The two most common ways to transform bacteria are to have them chemically compentent (E. coli already in a rich media broth) or to electrically transform them (electroporation). The purpose of both of these is to induce holes into to cell membrane of the E. coli (chemical transformation relies on the heat shock process for this). Once these holes are made, DNA is free to enter into the bacteria. Naturally, this process is very traumatizing to the E. coli, especially since chemical transformation has the added insult of temperature shock (0°C to 42°C then back down to 0°C).
Substituting LB for any rich broth, such as SOC, will greatly improve transformation yield. If a protocol calls for SOC media, and you don't have any, you may substitute for another rich media. I have used 2xYT for SOC many times quite successfully, and as I stated earlier, only the valence number for the various ions seems to matter, so just make sure they are present.
It was my understanding that sucrose/glucose was added as an additional nutrient source for E. coli to expedite their recovery from the transformation protocol. I speculate that this is the case. Hanahan refers to sucrose as a stabilizer but does not define what it is stabilizing. I speculate that it acts as a cryopreservation aid and prevents ice crystal formation when undergoing cooling on ice in the heat shock method. Given the earlier bio.SE question about shifting E. coli feedstocks, it seems unlikely that sucrose will be used as a nutrient source in the one hour growth period immediately after transformation because that article quotes 4-12 hours as the common time range to shift metabolism from amino acids to carbohydrates.
Sources: