$100$ is quite a special case.
You have a well-known Euler theorem that $a^{\varphi(n)}\equiv 1\pmod n$ if $a$ is coprime with $n$ and $\varphi$ is Euler's totient function. (See: Wikipedia.)
In fact, this can be strengthened a bit for some $n$: let $\lambda(n)$ be the smallest exponent for which $a^{\lambda(n)}\equiv 1\pmod n$ for all $a$ coprime with $n$. $\lambda$ is called Carmichael function. (See Wikipedia.)
In the case $n=100$, $\varphi(n)=40$ but $\lambda(n)=20$ and so $a^{20}\equiv 1\pmod{100}$ and consequently $a^{20q+r}\equiv a^r\pmod {100}$ for $a$ (such as $a=9$) coprime with $100$. That is why the statement from your question is true.
In general, if $a$ is coprime with $n$, you would say that $a^u\equiv a^v\pmod n$ if $u\equiv v\pmod{\varphi(n)}$, or, if this is not enough to reach a desired conclusion, $u\equiv v\pmod{\lambda(n)}$. However, in general, you can not replace the modulus in the last two formulas with $n$.
Note: It is known that $\lambda(uv)=\text{LCM}(\lambda(u),\lambda(v))$ for $u,v$ coprime, and $\lambda(n)\mid\varphi(n)$. Thus, knowing how to calculate Euler's totient function you can easily calculate the upper bound for the Carmichael function. In the case $n=100=4\cdot 25$, you have $\lambda(4)\mid\varphi(4)=2$, $\lambda(25)\mid\varphi(25)=20$ so $\lambda(100)\mid\text{LCM}(2,20)=20$. This does not exactly show that $\lambda(100)=20$, but is still good to conclude that $9^{20}\equiv 1\pmod{100}$