The deposit is the buyer's demonstration that they're serious. It is not a down payment, it is not a fee, and it isn't yours until closing.
How it moves
The buyer delivers it to the listing brokerage, normally within 24 hours of acceptance unless the agreement says otherwise.
It's held in the brokerage's real estate trust account: a regulated account, separate from the brokerage's own money.
It sits there until closing. Neither you nor the buyer can touch it in the meantime.
On closing it's credited to the purchase price, and flows to you through the lawyers.
How much?
In the GTA, deposits commonly run around 5% of the purchase price, though it is entirely negotiable and larger deposits are a recognised way for a buyer to strengthen an offer. A meaningful deposit is a real signal. It's the money the buyer forfeits if they walk.
This is the part sellers misunderstand. If a buyer fails to close, the deposit is not automatically yours. Once it's in trust, a brokerage can only release it on the written agreement of both parties or on a court order. A buyer who walks and won't sign a mutual release can leave the money frozen while you litigate.
Note too that a deposit forfeited is not necessarily the limit of a defaulting buyer's exposure. A seller who resells for less may pursue the difference. That's a matter for your lawyer.