Retainage (or retention) is a percentage of each progress payment the owner holds back as security that the work will be finished and defects fixed. Rates of 5% to 10% are common. The GC usually holds the same or a higher rate from its subcontractors, so retainage runs down the whole payment chain.
Many contracts reduce retainage once the job reaches a milestone, often 50% complete. There are two ways that reduction can work: the lower rate applies only to work billed after the milestone, or the owner releases retainage already held down to the new rate. Which one applies is set by your contract and, on many projects, by state law. Read both.
Retainage is earned revenue you have not collected. It sits in retainage receivable until the release trigger, often substantial completion or final completion with closeout documents. On a thin-margin job the retainage balance can be larger than the profit, which is why it has to be tracked as its own balance, and why the matching retainage payable to your subs has to be tracked too.
The common failure is not the math. It is forgetting to bill the release when the trigger is met, and letting a large receivable age because a punch list or an O&M manual was never closed.