Document the condition of your apartment before you leave, and let your landlord know where you're going.
When you are preparing to leave your apartment for good, you should request a meeting with the landlord so you can go through your apartment with him, so that he can assess any damage you have done. Give your landlord your forwarding address.
TAKE PICTURES of the condition of the apartment just before you walk out the door, and have a friend with you when you take the pictures. You may need this evidence later.
Wait 21 days for a breakdown of the money the landlord withheld to pay for repairs.
Within 21 days, your landlord must, by law, return your security deposit with a full breakdown on how he spent any part of it. (By the way, you are not responsible for repainting the apartment or recarpeting the place--the landlord has to pay for normal wear-and-tear.) If your former landlord spent more than $150 of your deposit, he must provide you with receipts for the money he spent making repairs. Be suspicious if you see "estimates" or hourly charges for the landlord, or for the maintenance man who works full time for the management company anyway.
IMPORTANT NOTE: If you live in Los Angeles in a rent-controlled apartment, your landlord is responsible to pay you interest yearly on your security deposit. If your landlord has not been paying you interest every year, make sure you receive this additional interest when you leave.
If the landlord keeps more than his fair share of the security deposit for repairs, sue him in small claims court.
If, after 21 days, you have not heard from your landlord, you should write to him demanding your full security deposit be repaid within 10 days.
After 10 days, if he has not returned the security deposit, you can, and should, sue him in small claims court for your full security deposit PLUS a penalty of two times the amount of the security deposit. (Example, if your security deposit was $1,000, and he kept the entire security deposit, you should sue him for $3,000.) The Court is authorized by Civil Code 1950.5 (l) (