There is no simple answer for this big question, it depends on who is the one making the deal fail through.
If it’s your fault,you may be responsible for the reimbursement to your agent. It is making sense if A Real estate agent pursue the commission if he/she did a good a job,like brought a satisfying offer to the seller client and the offer was accepted, but seller couldn’t close the deal for personal reasons.
if it’s the other party’s liability. For example a buyer couldn’t arrange sufficient fund to close the deal. As seller you might want to discuss with you client first before making any decision(something like sign a mutual release and keep the deposit). Because many people are involved in a real estate transaction,when you sign the paper, you’re no longer by yourself. Here is an example that An agent sued his seller client for commission：