The turn structure moves through several steps in the ending phase: the end step, and then the cleanup step. The end step is a normal game step where players receive priority and may cast instants or activate abilities (CR 500.1, CR 505.1).
When the end step begins, the active player receives priority first (CR 116.3). At this point, any player may cast instants, activate abilities, or take other actions that have priority as a prerequisite. This is why many cards say 'at the beginning of the end step' — triggered abilities fire here and go on the stack, and players can respond.
The cleanup step, by contrast, is special: no player normally receives priority during cleanup, and instants cannot normally be cast there (CR 514.1, CR 514.3). The cleanup step is where the active player discards down to maximum hand size and damage is removed from permanents.
Concrete example: Your opponent attacks and drops you to 2 life. During the end step, you cast Fog — wait, that's not right timing. Better: you have a 'Flash' creature you want to deploy. On your opponent's end step, you cast it as an instant (CR 702.34a), getting it onto the battlefield before your own turn, avoiding summoning sickness. This is legal because priority is active during the end step.
So cast your instants freely during the end step. Just remember that once the cleanup step starts, that window is closed unless a triggered ability causes another cleanup step to occur (CR 514.3).
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.