How many "quadratic residues" are there $\bmod p q$? And $\bmod p^{n}$?
We will just consider that the "quadratic residues" mod $n$ are among the integers coprime with $n$. The technique for studying $\mathbb{Z} / p q \mathbb{Z}$ is to study $\mathbb{Z} / p \mathbb{Z}$ and $\mathbb{Z} / q \mathbb{Z}$ separately and use the Chinese remainder theorem. We leave it to the reader to verify that $a$ is a quadratic residue $\bmod p q$ if and only if $a$ is a quadratic residue $\bmod p$ and $a$ is a quadratic residue $\bmod q$. Modulo $p$ there are $\frac{p-1}{2}$ quadratic residues, and $\bmod q$ there are $\frac{q-1}{2}$. The total number of quadratic residues mod $p q$ is therefore $\frac{(p-1)(q-1)}{4}$.

To look at mod $p^{k}$ we will proceed differently and take advantage of the fact that $\left(\mathbb{Z} / p^{k} \mathbb{Z}\right)^{*}$ is cyclic. We write all elements as powers $x^{n} d^{\prime}$ of a primitive root $x$. It is easy to verify that $x^{n}$ is a quadratic residue if and only if $n$ is even. The quadratic residues thus correspond to half of the elements, that is, $\frac{(\mathfrak{p}-1) \mathrm{p}^{\mathrm{k}-1}}{2}$.