Baked custards set because egg proteins coagulate into a network that traps water and fat. Heating that network too aggressively makes it contract and expel moisture.
What to do in practice
- Use moderate, even heat.
- A water bath can buffer rapid temperature change.
- Remove custards before residual heat pushes them too far.
If it is going wrong, check these first
- Boiling the custard in the oven
- Overbaking until completely rigid
- Whisking excessive air into a mixture meant to bake smooth