Verified Answer :

znk

The formula CaO₂H₂ correctly gives the relative number of each type of atom in the compound.
But the OH group usually behaves as a unit. It doesn't fall apart.
So chemists have agreed to write the OH group as a unit: Ca(OH)₂.
This shows that there are 1 Ca atom and 2 OH groups in a formula unit of calcium hydroxide.

Answer:

It's written  \(Ca(OH)_2\)  because of its dissociation behavior

Explanation:

The \(OH^-\) is a functional group called hydroxyl and is the product (for example) of the dissociation of water.

When formulating compounds like the \(Ca(OH)_2\) called hydrides , hydroxyl groups are added like blocks to balance the valence of the other element (in this case Ca).

At the  dissociation, O and H stay bonded because of the very strong afinity this atoms have and this is why they are written as a unit.