But the way that most brewers do it, because it's The Best Way, is to put the mash into a big strainer and rinse it with hot water. This process is called "lautering." As you draw more and more wort out of the lauter tun, the concentration of sugars in the liquid goes down. You can measure this concentration by taking the gravity of the wort as it comes out, before it is placed in the boil kettle. (Note that gravity is the density of the liquid relative to water, which has a density of one.)
When we first started all grain brews, we measured the gravity, and we stopped when it got to about 1.012, because that's what we had been told to do by Bob the Beer Man. This was usually a stupid idea, because it meant that we ended up with around 7 gallons of liquid when we were only shooting for 5. We typically ended up boiling off a lot of liquid, and making really dense beer.
Bob, the Beer God (not the same Bob), indicated that we probably didn't need to do this -- that we could probably get away with drawing off a certain amount of liquid instead of worrying about the gravity. So we did this for a few weeks.
Turns out, in fact, that neither one of these is correct. You should be worried about both.
If you only worry about the gravity of the beer coming out of the lauter tun, you end up with beer that's too concentrated. If you only worry about volume, you'll end up drawing off-flavors out of the mash. You need to do both. How?
The answer? Math. If you've calculated your malt bill accurately, you should be able to draw off exactly as much liquid as you calculated for (in our case, this is usually 11 gallons), and the gravity at the end of that draw should be around 1.010, just high enough to avoid off-flavours. Now you have the gravity you were targetting, plus you have avoided the mess of having too much wort, or an over-concentrated wort.
If your math is wrong, or if you notice that somethings going wrong, what can you do? Well, if you don't have enough liquid, and your wort is settling at around 1.010, you'll need to adjust something. You could readjust your hop bill and simply make less beer (but who wants that?), or you could add more liquid to the wort. Assuming that all you're short is a gallon or so out of ten, you can probably get away with adding light malt extract and water to the kettle without imparting too much additional flavor to the beer. If you're short quite a bit, you'll have to start over.
If you find that you've drawn off almost as much liquid as you want, and the gravity is still pretty high, you can dillute the wort in the kettle with water. No big deal.
Remember also that during this entire process there are two gravity values that you're worried about -- first, the gravity of the runoff from the lauter tun, and second, the total gravity of the liquid in your collection tank.
Lautering is arguably the most important process in brewing that you actually have complete control over. Other processes (fermentation, hop addition, mashing, etc) might matter more, but you are in less direct control of how those processes turn out in the end. As such, I'm sure we'll talk more about lautering in the future... Eventually, this kind of this will be added to the Beer 101 section as well, which is feeling very dillapidated of late.