The head gasket is located between the engine's cylinder head and block. When a spark ignites gasoline in the engine, the explosion creates pressure in the engine. The head gasket provides a seal that keeps that pressure contained within the engine's cylinder. The head gasket also provides a seal for internal engine water and oil passages.
Replacing the head gasket requires major engine dismantling. The cooling system is drained, and the intake and exhaust manifolds are removed. The timing cover, timing belt (or timing chain), and valve covers may also need to be removed. In order to gain access to the bolts and hardware securing the cylinder head to the engine block, the camshafts may need to be removed.
After the cylinder head is removed, the cylinder head and engine block surfaces are cleaned and examined for damage. The head gasket is replaced and engine components reassembled.
Mechanics' Corner: More Technical Detail
Head gasket failure caused by severe or repeated engine overheating will necessitate close inspection of the cylinder head itself for cracks, as well as measurements taken to assure that the cylinder head is not warped. A warped cylinder head can often be machined flat, but it may have to be replaced.
Due to the damaging effects of coolant entering the combustion chamber, oxygen sensor and/or catalytic converter replacement may be prudent or even necessary. This is especially true if head gasket failure was severe or prolonged.