Yes, a lawyer can withdraw mid-case. There are certain times that a lawyer must withdraw, and other times where a lawyer may permissbily withdraw. In those sitautions where withdraw is optional, the lawyer just needs some good cause. Rule 1.16 of the Rules of Professional Conduct discusses when and how a lawyer may withdraw, and I've attached a link to the rule below.
With regard to what you have paid, a lawyer may require advance payment of a fee, but is obliged to return any unearned portion. This does not apply when the advance payment is a true retainer to reserve services rather than an advance to secure the payment of fees yet to be earned. Check your contract for legal services to see which situation applies to you.
This information is provided for general purposes only and should not be construed as legal advice. No attorney-client relationship is created with the furnishing of this advice. Attorney licensed in North Carolina only.
I agree with Mr. Rothrock. The letter should explain the withdrawal. Much also depends on if you are in a filed court case or outside of Court. In a Court case he must file a motion with the Court. You should review the letter and reason for withdrawal with another attorney to see if it is valid.
As Mr. Rothrock indicated, there are situations when we MUST withdraw from a matter depending on various circumstances.