Friends, treatment of retention money in both of scenraios will depend upon the underlying agreement. Typically renetntion money is 10 percent (which can be less or more than it) of the contract value and is dedcuted from all the payments to be made to the contractors against the certified work. Retention money is a credit balance payable to contractor upon finalization of satisfied completion and performance of work. It is normally paid to contractor after one year of completion of contract work. However, this will again depend upon agreed terms.
If the contractor does not complete the work or the work performed by him is not satisfactory, the retention money may not be paid to him depending upon agreed terms. In such case, it can be kept as a liability in some "sundry liabilities" account and added back to profit and loss account as other income. Normally people keep the liability for 3 years and then add it back as income. This is done so that no issue arises in taxation as tax laws require adding back after 3 years. Other recoveries, damages or legal proceedings, or arbitration etc, everything will also depend upon the agreement and then legal rights under the specific circumstances.
If the work done is satisfactory, as per requirement, is certified and completed, the amount retained as retention money will keep on standing as liability in the books of account until the payment date AS PER AGREED TERM arrives. On which date the liability will be paid to the contractor. Remember, amount to be retained, retention period, payment methodologies, all dependd upon agreement with contractor.