Be sure that the apartment is in the same condition as when you moved in. Clean it thoroughly and make any small repairs necessary.
Give the landlord proper notice. If your rent is due every 30 days, give 30 days notice or give notice according to the lease agreement.
Write a letter stating your intention to move. Date the letter and make a copy of it for your records. Notice can be issued anytime, but the rent needs to be paid until the property is vacated.
Deliver the letter in person or send it certified mail with a return receipt. Once you've moved out, turn your keys in to the landlord and give him your new address if you are owed a portion of your deposit.