How do I efficiently compute $a^b\bmod c$:

- When $b$ is huge, for instance $5^{844325}\bmod 21$?
- When $b$ is less than $c$ but it would still be a lot of work to multiply $a$ by itself $b$ times, for instance $5^{69}\bmod 101$?
- When $(a,c)\ne1$, for instance $6^{103}\bmod 14$?

Are there any other tricks for evaluating exponents in modular arithmetic?

This is being asked in an effort to cut down on duplicates, see here and here.