Proving $5^n \equiv 1 \pmod {2^r}$ when $n=2^{r-2}$ How can I prove that $5^n \equiv 1 (\bmod 2^r$) when $n=2^{r-2}$? 
Actually what I am trying to prove is that the cyclic group generated by the residue class of $5 (\bmod 2^r)$ is of order $2^{r-2}$.  

We divide your original problem into two parts.  The specific question you asked has nothing to do with $5$ and is answered for all odd $a$ in Part $1$. The fact that the order of $5$ is actually $2^{r-2}$ and not something smaller is proved in Part $2$.  
Part $1$: Suppose that $a$ is odd, and $r \ge 3$. Then $a^{2^{r-2}}\equiv 1 \pmod{2^r}$.
Since $2^r$ does not have a primitive root, the order of $a$ modulo $2^r$ is less than $\varphi(2^r)$.  But the order of $a$ divides $\varphi(2^r)$.  Since $\varphi(2^r)=2^{r-1}$, it follows that the order of $a$ is a divisor of $2^{r-1}$ which is less than $2^{r-1}$.  Thus the order of $a$ divides $2^{r-2}$. It follows that $a^{2^{r-2}}\equiv 1 \pmod{2^r}$.  
Part $2$: We show that if $r\ge 3$, then $5^{2^{r-3}}\not\equiv 1 \pmod{2^r}$.  This will show that the order of $5$ modulo $2^r$ is actually $2^{r-2}$, and not something smaller.
We show by induction that $5^{2^{r-3}}\equiv 1+2^{r-1} \pmod{2^r}$, and so in particular $5^{2^{r-3}}\not\equiv 1 \pmod{2^r}$.
It is easy to check that the result holds at $r=3$. Suppose now that $5^{2^{k-3}}\equiv 1+2^{k-1} \pmod{2^k}$. We show that $5^{2^{k-2}}\equiv 1+2^{k} \pmod{2^{k+1}}$.
By the induction assumption $5^{2^{k-3}}= 1+2^{k-1} +s2^k$ for some $s$. Square both sides, and simplify modulo $2^{k+1}$. We get that
$$5^{2^{k-2}}=(1+2^{k-1} +s2^k)^2 \equiv 1+2^k +2^{2k-2}\pmod{2^{k+1}}.$$
But $2^{2k-2}$ is divisible by $2^{k+1}$, since $k \ge 3$. The result follows.
