When heated, the protein in egg whites, and more particularly in the yolks, cooks and coagulates. Ideally, the solidifying protein simultaneously thickens the liquid (for example, milk) in which it is suspended. Under ideal conditions, there is an optimal proportion of egg protein to other ingredients. For the standard milk-based custard, use one large egg for every 2/3 cup of milk. If the egg size is small, medium, extra large, or jumbo, adjust the ratio accordingly. Since egg white also contains protein, you can use the whole egg, counting each egg white as about the equal of one egg yolk. (Your finished custard, however, will not be as rich and smooth-textured as one thickened strictly with yolks).
Milk itself contains proteins that thicken, so if you substitute a liquid such as water in a recipe, you will need to increase the number of eggs. Extra egg is also necessary if you add sugar, and even more so if you add acid, because these ingredients reduce the thickening ability of protein.
For the sake of simplicity, protein is generally referred to in singular. Technically, however, there are many types of protein. Since each type solidifies at a different temperature in a zone ranging from slightly below 140 degrees F to slightly below 180 degrees F, we must temporarily switch to the plural to draw attention to their different properties. Your custard mixture reaches its full glory when it is heated to slightly below 180 degrees F, the temperature at which all the proteins have finally coagulated. Above 185 degrees F, some of the proteins lose their coagulating effectiveness and your custard starts to "weep". Prolonged cooking, even below 180 degrees F, does the same damage.