On the day, once settlement completes, if the property is empty.
If the seller lives in the property they can stay until 12 noon the following day, so the keys come to you then. The agent normally holds them. We tell both you and the agent as soon as settlement has gone through, so you can arrange the handover.
On a private sale there is no agent, so you and the seller arrange the handover between you.
See I have sold my house. When do I move out? and What to do before settlement: a buyer’s checklist.