Assuming that the parties to the contract are capable, there has been no mistake or misrepresentation, the contract is not illegal and there has been a clear offer and acceptance, then there are several ways in which a contract can be discharged.
Discharge by Performance
Most one-off contracts are discharged by performance - by doing what was agreed (eg by delivering the goods ordered).
Discharge by Release
In some circumstances one party may agree to release the other from its obligations.
Substituted Contract
The parties may terminate one contract by substituting a new one. It is sometimes difficult to distinguish between an amendment made to an old contract and the substitution of a new contract. If the old contract was in writing, amendments and substitutions should also be in writing.
Intervening Circumstances (Frustration)
Where circumstances beyond the reasonable control of the parties occur, such that the contract becomes impossible to perform, the party directly affected by such circumstances may be relieved of its obligations under the contract. A contract may include a term, usually known as the 'force majeure clause' which sets out the circumstances in which the contract ends, otherwise the matter is decided by the courts which adopt a narrow approach.
Time
Sometimes it is made a condition of a contract that it must be performed by a certain time. If such a condition is not complied with, the injured party may treat the contract as at an end.
Termination of Contract
Some contracts, particularly for services, contain a clause covering notice provision for termination.
Bankruptcy or Insolvency
It is common for contracts to provide that the bankruptcy or insolvency of either party brings the contract to an end.