What is the remainder of $(14^{2010}+1) \div 6$?
Someone showed me a way to do this by finding a pattern, i.e.:
$14^1\div6$ has remainder 2
$14^2\div6$ has remainder 4
$14^3\div6$ has remainder 2
$14^4\div6$ has remainder 4
And it seems that when the power is odd, the answer is 2, and when it's even, the answer is 4.
2010 is even, so the remainder is 4, but we have that +1, so the final remainder is 5. Which is correct.
But this method doesn't seem very concrete to me, and I have a feeling the pattern may not be easy to find (or exist?) for every question. What theorem or algorithm can I use to solve this instead?