A retainer agreement is a contract between a lawyer and a client. It spells out the terms and conditions of the lawyer’s employment, including the reason the dismissal by the client and/or withdrawal by the lawyer.
The agreement spells how an attorney’s fees are paid. The agreement spells out his hourly rate of others in his employment. Most lawyers ask for a deposit, and then begin to withdraw from that deposit based on their hourly rate. In general in most cases, unused money is returned to the client at the end of the case.
For maximum clarity, and the protection of both lawyer and client, the agreement should be in writing.