Depending on what type of beer you're brewing and the malts you're using, you may need or want to employ a different mashing technique to the most common type, which is a single infusion mash. If you're new to all-grain brewing, stick to single-infusion mashing while you get other aspects of your brewing perfected.
Once you're comfortable with the concepts of all-grain brewing you can try step or decoction mashing. There is nothing wrong with single-infusion mashing and for just about every type of malted grain that homebrewers come across it is an appropriate mash technique that will produce excellent beer.
In a single-infusion mash, the mash is held at the same temperature for the duration of the mash, although in practice the mash temperature may drop a degree or two unless heat is applied — either directly to the mash or mash tun, or by adding boiling water to the mash. During the entire period of the mash the enzymes in the malt convert the starch to differrent types of sugar during the "saccharification rest". A single-infusion is the most common method of mashing used by homebrewers.
A step mash can help avoid "gumminess" of the mash and chill haze in the finished beer when lots of unmalted grain or poorly modified malt is used (more on this below). With a step mash, the temperature at the start of the mash is low, usually about 50C, and is held for 20 to 30 minutes. During this phase proteins are broken down that would otherwise cause haze when the finished beer was chilled or cause the mash to be viscous, or gummy. For this reason, this phase is called a protein rest. After the protein rest the mash temperature is raised to the same temperature employed during a single-infusion mash — 65C to 70C — for the saccharification rest, during which starch is converted to sugars.
The vast majority of modern malts are well modified and do not require or benefit from a step mash. However, some European malts are intentionally poorly (or under) modified and require a step mash to break down their proteins. Many brewers believe that these undermodified malts and a step mash are essential to brewing certain beers, such as German pilsners, that taste authentic.
A decoction mash is essential to the malty, rich taste of beers such as Bohemian pilsners. In a decoction, a portion of the thickest part of the mash — including the grain — is removed from the mash tun, boiled then returned to the mash, thus raising the temperature of the mash. In this sense, a decoction mash is a variation of a step mash, because the temperature of the mash increases each time a portion of the mash is removed, boiled and added back to the mash. The boiling of part of the mash caramelises some of the sugars, enhancing the flavour. The increase in temperature of the entire mash when the boiled part of the mash is returned may be done once (single decoction), twice (double decoction) or three times (triple decoction).
Brewers are told that grain should never be boiled because it can extract tannins and cause unpleasant flavours. However, removing a part of the grains from the mash and boiling it is an exception to this and will not be detrimental to the beer.