one example has Cl2 ( that is an L)

the other has (OH)2

I still do not understand the difference if it has brackets or does not have brackets around it

What's to understand. If brackets (you used parentheses which is the usual way to do it) or parentheses, it means to multiply everything inside the parenthese by the number in the subscript. So.

Mg(OH)2 has 1 Mg atom, 2 O atoms and 2 H atoms.
MgO has 1 Mg atom and 1 O atom.
Al(OH)3 has 1 Al atom, 3 O atoms, and 3 H atoms.
(CN)2 has 2 C atoms and 2 N atoms in the compound cyanogen.
(NH4)2CO3 has 2 N atoms, 8 H atoms, 1 C atom and 3 O atoms in the compound ammonium carbonate.