Every development loan starts with the feasibility: what the project will cost in total, what it will be worth on completion, and the margin in between. Lenders often call the completion value the gross realisation value (GRV).
Lenders limit their loan by both cost and completed value: a share of total development cost, and a share of GRV. Interest during the build is usually added to the loan rather than paid monthly, so it has to fit within those limits too.
Banks often want a share of units pre-sold before they fund. Non-bank lenders may need fewer pre-sales, at a higher cost. Mezzanine finance can sit behind the main lender to reduce the equity you need, at a higher rate again.
Progress payments are usually certified by a quantity surveyor as each stage is completed. At the end, the loan is repaid from sales. Any units still unsold can be refinanced with a residual stock loan.