The termination must be done in written form. For reasons of proof, you should send it as a registered letter (the delivery only recurs after the recipient’s signature). For the termination to be considered as legit, it must be signed by each tenant (especially important for residential communities). If you are married and live with your partner, the termination must be signed by both of you, even if only one of you signed the rental contract.
Normally, you can find both the period of notice and the termination dates in the rental contract. You have to consider both for an ordinary termination. According to legislation, the period of notice for apartments should at least be three months. This is also valid for rooms in residential communities. A period of notice of only two weeks is only permitted for furnished apartments. You can always agree on a longer period with your landlord, however shorter periods are not legally valid. However you can freely decide on the termination dates. If there are no contractual regulations, the notice period is three months. You also have to consider the local termination dates. You can request all informations from the responsible arbitration authority.
A non-ordinary termination is a termination out of the termination dates. The rent must be paid until the end of the ordinary rental period If no tenant could be found.
As a tenant you have to find a reasonable and solvent new tenant who is willing to take over the existing lease. The rent should not be more than one-third of the persons income. The new tenant can be considered as reasonable, if he is "similar" to the moving out tenants or other residents of the building: a large family could be unsuitable for the apartment if the former tenant was living alone. The landlord is granted a verification period of two to four weeks. He is not forced to accept your new tenant. However, if he declines a reasonable and solvent tenant, you are freed from your contractual obligations until the day to which the new tenant had taken over your rent contract. This regulation also applies if, for example, the landlord wants to use the property for himself, wants to renovate it or if he raised the rent for the tenant and he doesn’t accept it.