Sparging is the rinsing of the grain at the end of the mash to remove the last of the sweet wort.
Hot water — usually about 76C — is used to sparge because the sugar and water mixture is less viscous, or more runny, at this temperature than at mash temperature and therefore more of the remaining sugar is rinsed from the grain. The other reason for using hot water is to denature, or kill, the enzymes in the mash, although these will be killed during the boil anyway.
There are several approaches to sparging.
To batch sparge, the entire sweet liquid is drained from the grain at the end of the mash. The full volume of sparge water is then added to the mash vessel, mixed with the grain then drained again.
With batch sparging and fly sparging (see below) it is imperative that the liquid is drained slowly. Running off quickly risks compacting the grain, thus preventing the mash from draining. Running off too quickly also encourages channels to form through the grain as the water takes the path of least resistance. If this happens, most of the grain will not be sparged because the sparge water will never get near it as it runs through the channels.
In fly, or continuous, sparging, sparge water is added to the mash vessel at the same rate as the liquid is being drawn off. This maintains the level of liquid in the mash vessel until the sparge water is exhausted, at which time draining continues until all the liquid is drawn off the grain bed.
As well as running off slowly, diffusing the water being added to the grain bed is important because if it is concentrated in a few spots channels will form through the grain.
Methods of diffusing the water when fly sparging include rotating, sprinkler-like devices; a large aluminium container with holes punched in it that floats on top of the mash; and simply sprinkling the sparge water on top of the mash manually.
As discussed in the step-by-step instructions for brew in a bag and three-vessel brewing, sparging is not essential. Most commercial brewers sparge the grain at the end of the mash to extract as much sugar as possible from the grain and thus reduce their costs. Some homebrewers elect not to sparge, because their equipment is not designed for it (BIAB and Braumeister are usually no-sparge) or because they feel that it results in a better flavour in their beers. Or just because they can't be bothered with the extra step. A small amount of extra malt is usually required to allow for the sugar left behind in the grain due to no-sparge, but for most homebrewers this cost is negligible.