To begin with, the links below explain what a cap is and the forecasting implications of a cap. The rest of this essay will explain what creates a cap in the first place.
A cap is a layer of air that prevents convection or limits dynamic lifting. Another way of describing a cap is that it is a layer of stable air aloft. Below are some common ways a cap can form:
1. Sinking air aloft: Sinking air warms at the dry adiabatic lapse rate. Suppose the air near the surface is not sinking but there is a layer of air around 800 mb for example that is sinking. Over time the air will become more stable. A stable situation occurs when there is warmer air above cooler air or the temperature lapse rate is weak. This situation can occur when high pressure is influencing the weather. The surface may be warm and moist and it feels unstable at the surface but a layer of very stable air aloft can prevent the warm and moist air near the surface from convectively rising into thunderstorms.
2. Horizontal advection of hot air aloft: This is a primary process that creates the famous Great Plains capping inversions that can either prevent storms from occurring or holds off thunderstorm activity until the heat of the day. The geography of the plains is that the elevation generally increases moving from the east to the west. Further west of the plains the elevation increases further into mountains and high plateaus. In the warm season, the air over the high plains, mountains and Mexican plateau is often dry and hot during the day. When the upper level flow pattern has a component of wind coming from the west then this air will be advected toward the east. Since this hot dry air originates at higher elevations it will stay around that higher elevation as it moves east. As the hot air moves east the air is higher and higher in elevation above the surface since the land elevation of the plains decreases when moving east. This can create situations in the plains where there is warm and moist maritime tropical air near the surface and hot and dry continental tropical air above. The hot and dry air creates a cap. This cap is most noticeable in the morning hours when the air near the surface has cooled off but the air aloft is very warm.
3. Shallow cold front: Cold air is dense and tends to spread along the earth's surface and hug the earth's surface. When a shallow cold front moves through it creates a stable situation with cold air at the surface with warmer air above the shallow cold air. Once a cold front passes the chances for thunderstorms usually decreases significantly. There are special situations in which thunderstorms can still occur but generally the chances of strong and severe thunderstorms ends once the cold front passes.
4. Cooling at night of earth's surface: This is a very common way a cap is developed. The creation of this type of cap is a reason why thunderstorms are less common in the early morning than they are in the afternoon and evening. At night the earth's surface cools through longwave energy emission. If the skies are clear then the cooling is most significant. In the early morning hours the air at the surface will have cooled off while the air higher aloft is not influenced. This creates the classic radiational cooling cap. This type of cap weakens through daytime heating.