how does a hydrate form?

Generally water adds to a metal ion to the d,s, and or p orbitals in which the metal acts as a Lewis acid. I can reword that somewhat if you haven't studied about Lewis acids.

When a hydrate forms, it involves the addition of water molecules to a compound, usually a metal salt or an ionic compound. This process occurs through a chemical reaction wherein water molecules coordinate with the metal ion, resulting in the formation of a hydrate.

To understand this process, let's consider the formation of copper sulfate pentahydrate (CuSO4·5H2O) as an example. Copper sulfate is an ionic compound consisting of copper ions (Cu2+) and sulfate ions (SO4 2-). When it comes into contact with water, the copper ions attract and bind with water molecules.

The water molecules act as ligands, meaning they form coordinate bonds with the copper ions. The oxygen atom in each water molecule donates a lone pair of electrons to the copper ion, which is known as a Lewis acid (a substance that can accept an electron pair). As a result, each copper ion gets surrounded by several water molecules, forming a complex.

In the case of copper sulfate pentahydrate, each copper ion is coordinated with five water molecules, giving rise to the pentahydrate formula. The resulting compound contains both the original copper sulfate ions and the coordinated water molecules, held together by ionic bonds.

It's important to note that the process of hydrate formation depends on the specific compound and the properties of the metal ion involved. Different compounds may have different numbers of water molecules associated with them, leading to varying hydrate formulas.