The natural function
$$f_k(n) = n^2 \bmod k,\quad f_k(n) \in [0;k-1]$$
has at least the fixpoints $n\in\{0;1\}$ for each $n$, but for some $k$ there are other fixpoints. For instance, $f_{100}$ has the fixpoints $\{0;1;25;76\}$. Apart from trying out every possible value for $n$, is there a systematic way to get all fixpoints for a given $k$?
Along with the Chinese Remainder theorem, you need to be able to factor your $k$ into prime powers. It is a theorem requiring induction that the only solutions to $$ n^2 \equiv n \pmod {p^t} $$ for a prime $p$ and $t \geq 1$ are $$ n \equiv 0,1 \pmod {p^t}. $$ As a result, if your $k$ is divisible by exactly $r$ distinct primes, there are exactly $2^r$ of your fixpoints. For $100,$ note that you got precisely the four numbers from $0$ to $99$ that are $0,1 \pmod 4$ and $0,1 \pmod {25}.$
Let's see, the theorem mentioned is straightforward for odd $p,$ induction on $t.$ Slightly different for $p=2$ but easy enough and still true.
Induction, odd $p$: with $0 \leq j \leq p-1,$ then $\delta = 0,1,$ and $t \geq 1,$ we are solving $$ (j p^t + \delta)^2 \equiv j p^t + \delta \pmod {p^{t+1}}, $$ $$ j^2 p^{2t} + 2 j \delta p^t + \delta^2 \equiv j p^t + \delta \pmod {p^{t+1}}. $$ Note $\delta^2 = \delta,$ and $2t \geq t + 1.$ So $$ 2 j \delta p^t \equiv j p^t \pmod {p^{t+1}}, $$ $$ (2 \delta - 1) j p^t \equiv 0 \pmod {p^{t+1}}, $$ $$ (2 \delta - 1) j \equiv 0 \pmod {p}, $$ $$ j \equiv 0 \pmod {p}, $$ $$ j = 0. $$
Induction, $p=2$: with $j = 0,1,$ then $\delta = 0,1,$ and $t \geq 1,$ we are solving $$ (j 2^t + \delta)^2 \equiv j 2^t + \delta \pmod {2^{t+1}}, $$ $$ j^2 2^{2t} + 2 j \delta 2^t + \delta^2 \equiv j 2^t + \delta \pmod {2^{t+1}}. $$ Note $\delta^2 = \delta,$ and $2t \geq t + 1.$ So $$ 2 j \delta 2^t \equiv j 2^t \pmod {2^{t+1}}, $$ $$ j \delta 2^{t+1} \equiv j 2^t \pmod {2^{t+1}}, $$ $$ 0 \equiv j 2^t \pmod {2^{t+1}}, $$ $$ 0 \equiv j \pmod {2}, $$ $$ j = 0. $$