When you sign a contract with a tenant (and a lease is a legally binding contract) you and the tenant are both committing to a set of agreements between you both. Neither party can pick and choose which agreement that they wish to keep at any given moment, but must abide by the lease at all times or face potential consequences. This is why going over the lease in detail at the beginning is so important. In the same way that the tenant must pay rent on time, keep the property well maintained, and abide by the time period the lease is set for. In the same way you, as the landlord, must respond to maintenance request in a reasonable amount of time, alert tenants of any inspections that must be conducted, and, if it comes down to an eviction, follow through with the legal requirements.
If you both sign a twelve month lease and the tenant decides five months into it that they do not wish to live there anymore, in most cases this will be considered breaking the lease. There are exceptions to most general rules, of course, and some of these would include (but are certainly not limited to) if your tenant is military and has received orders to relocate or if the property is no longer inhabitable. If they are a civilian that chooses to move for a relocation, this is not covered, or if they choose to move for family obligations or money issues. They may approach you and an agreement may be made between you, but it must be agreed to by both parties. Sometimes landlords will be lenient and allow the tenant to help them find a replacement to help them both out. There may be certain requirements for this based on your local laws, so make sure that you do check them.
In the end, if a tenant not covered by a legal exception breaks the lease and leaves your property early without paying money owed, it won't matter how well of a shape they leave the property, they likely will not see (or even expect to see) their deposit after they leave.