Eggs serve several purposes in baking, including adding structure, firmness, color, flavor and even leavening. The specific function of eggs in a given recipe depends in part on the recipe and in part on whether the whole egg, the white or the yolk is being used. In addition, eggs can help baked goods to look more appetizing.
As eggs cook, they become firm. This is as true when the eggs are used in a baked goods recipe as it is in hard-boiling eggs to eat. That firmness helps to set the physical structure of cookies, cakes and even some cheesecakes.
When egg yolks alone are used with the whites strained out, they add a luscious yellow tone to a batter or dough. Egg yolks contain virtually all the fat of an egg, so using them also adds a richness to baked goods that comes through not just in the flavor but also in the feel of the food on the tongue.
Egg whites are also extremely useful on their own. Whipped egg whites can be used to aid in leavening since they hold in air bubbles and help the flour to rise to greater heights as is seen especially in angel food cakes. Whipped egg whites are also the basis for meringues, either used to top lemon or lime-based pies or baked into a cookie form. Finally, brushing on a little beaten egg mixed with water adds an attractive shine to the top of any flour-based baked good, including bread crusts, pie crusts, biscuits or pretzels.