This is the heart of the all-grain brewing process. It is what separates wine makers from brewers. Unlike grape juice, fruit juice, honey, etc. where the sugar is ready to go and all the vintner really has to do is add yeast, brewers have to coax the demure, shy sugars out of the grain through a fairly technical procedure called mashing.
When asked by non-brewers to explain the brewing process, I often describe it as making a big bowl of oatmeal (mash) and then trying to hold the oatmeal at a very specific temperature. There is much discussion on the specifics of heating and maintaing the temperature of the mash, from hitting the target temperature at the initial strike, through maintaining the target temperature for the duration of the mash. The temperature is critical because there are specific enzymes that come into play at very narrow temperature ranges (2 – 3 degrees F) to convert the starch to sugar by molecularly breaking the long carbohydrate chains that are starch into smaller sugar chains. The more starch that is converted to sugar, the higher the "efficiency" of the process.
Amylose (starch) Molcule
Unfortunately, the enzymes are rather delicate and are destroyed (denatured) if the mash rises above this very narrow temperature range. This is referred to as "overshooting". Once the overshoot occurs, you can not really let the mash drop back down into your desired temperature range and maintain the full conversion of starch to sugar because the damage has already been done to the enzymes. The only option really left is to go ahead and maintain the higher temperature provided you have not completely overshot the full conversion temperature ranges. Generally speaking, there are three ranges that are targeted during the mash, each of which contributes to a different mouth feel/fermentability of the beer based on the length of carbohydrate chain left after the conversion. Lower temperatures make smaller chains, for a lighter, more fermentable beer like lagers, and higher temperatures leave longer chains for heavier beers like stouts. All of these ranges reside between roughly 145° F and 157° F. The idea is to either hit the target dead on, or undershoot and have a method to then rise into the target temperature.
There are basically three techniques used to do this. The first involves various methods to infuse water that is hotter than the mash to bring the temperature up to the desired range. The downside of infusion mashing is the lack of control. Formulas are used to calculate the amount of water and temperature to use, but given environmental variables it can be hard to hit, and then maintain the temperature you desire. The second is directly heating the mash tun. Negatives to this method include potential scorching of the grist/wort, or stratification of the mash where the grist around the area receiving the heat rises much higher than the rest of the mash, which destroys the enzymes in that localized area. The third utilizes a heat source external to the mash tun through which the wort is circulated to hit and hold the target temperature. Professionally, this is known as a calandria; in home brewing circles this is known as RIMS (recirculating infusion mash system) or HERMS (heat exchanged recirculating mash system) depending on the particular setup.
There is a fourth, involving injection of steam into the mash, but this process goes beyond the scope of this site.
BobbyFromNJ on YouTube has an excellect discussion on mashing and starch conversion.