Sorry to hear of the issue.
We can't give legal advice as we are not a law firm (we are an internet forum) - we are limited to online Q&A information and guidance from a legal standpoint.
If you are planning to make a claim for breach of your human rights, you will need a lawyer for this - you may qualify for a no win no fee agreement with nothing to pay up front. Or you may qualify for legal aid in a case like this.
Under the Mental Health Act 2005 you can be detained against your will if you have a psychological illness and by not detaining you, this would either pose a risk to yourself or others (or both). You can make a complaint to the managers of your NHS or private hospital. If this does not help, you can then ask your Care Quality Commission (CQC) to investigate the complaint - you need to contact CQC Mental Health Act, Citygate, Gallowgate, Newcastle, NE1 4PA (by post) or by telephone: 03000 616161 (then press 1 to speak to the mental health team). Or you could email them :***@******.***.
You should also contact your local Healthwatch who are patient's consumer champions and they can assist with the complaint.
Yours can be found here: https://www.healthwatch.co.uk
You could also ask your local Member of Parliament (MP) to look in to the complaint - they could exert some pressure.
Your local MP can be found here: https://members.parliament.uk/FindYourMP
As for a claim for compensation, a law firm will be required as I say - any of the following could assist you with this :
1. https://www.hja.net/legal-services/civil-liberties-and-human-rights/human-rights/
2. https://www.duncanlewis.co.uk/HumanRights.html
3. https://www.leighday.co.uk/our-services/human-rights/