Check your states Landlord Tenant Laws. Make sure you have not done anything to give your landlord a legal right to keep your deposit. If not, then check with your local court clerk for the appropriate forms. They can assist you in filing a motion asking the court to force your landlord to return the deposit.
The first thing to do is get the copy of your lease out and read it carefully. It should have outlined the conditions under which you would get your deposit back. There should, also, be a time frame that the landlord has in which to return the deposit. To go to court you will need copies of all documentation.
Have photos that show the apartment or property was in pristine condition when you left, so that the deposit for cleaning was not necessary. Have proof that you paid all bills so that they deposit cannot be kept for unpaid bills.
First you need to prove that the landlord kept your apartment in poor living conditions. For example, if you had a toilet that wasn't working properly, you should document your efforts to get this fixed. It's also good to get pictures of any damages that may have occured due to any disasters.