In the days of rimmed cartridges, headspace was simply the space allowed in a rifle or pistol for the rim, or "head" of the cartridge. That definition is still correct for rimmed and semi-rimmed cartridges. For belted cartridges, like many of the Magnum rifle cartridges, the headspace is basically the same, with the belt considered a thick rim.
Another way to look at it is the amount of space allowed between the breechface and whatever provides support for the cartridge when it is fired.
When rimless cartridges were developed, the case was supported on its shoulder or, in the case of some pistol cartridges, on the case mouth. These then became the points from which headspace is measured.
A rifle cartridge presents a problem for headspacing. When such a cartridge is fired, the thin forward walls of the case move outward under pressure and grip the walls of the chamber. The thicker part of the case at the rear cannot expand, and the pressure will move it back as far as possible. If the "headspace" allows, the case will stretch beyond its elastic limit and tear apart. This can release gas with some degree of danger, or simply leave part of the cartridge case in the chamber, making the gun useless until it is removed.
Because of normal manufacturing variations, mass produced rifles cannot have perfectly precise chambers, and ammunition cannot be produced in an exact size. Both are made to tolerances. The idea is to ensure that there is never a failure with ammunition that is within spec, fired in a chamber that is within spec.
A GO gauge ensures that the rifle will accept the longest cartridge that is within specs. A NO-GO gauge ensures that the rifle will not be dangerous with the shortest cartridge that is within specs (it allows for the normal "stretch" of the case). Both are used in factories and when rebarrelling or replacing the bolt on a rifle. The FIELD gauge is for use with used rifles. It detects a condition in which normal wear and tear has made or is beginning to make a rifle dangerous to fire.
HTH
Jim