$S$ represents spin, signifies the number of unpaired electrons in the system. For example, if the number of unpaired electrons is $1$, then $S=1/2$. $S^2$ is calculated as $S(S+1)$.
From what I have read, the $S^2$ value of a broken-symmetry singlet (contaminated by a triplet) is $1.0$, which is calculated to be the average of the singlet and triplet $S^2$. Similarly, the $S^2$ of broken-symmetry doublet (contaminated by the quartet state) turns out to be $1.75$ (average of a doublet and a quartet). I would like to know how these average values are being calculated. I understand that these are weighted averages (as $1.75 \neq 0.5\cdot(0.75+3.75)$, where $0.75$ and $3.75$ are $S^2$ values of doublet and quartet, respectively), but I don't know how that weighting is being done. I would be grateful if someone could provide a detailed explanation (mathematical derivation) of this.