I was a bit quick, but basically you make repeated use of Eulers theorem that says a^phi(n) = 1 mod n if gcd(a,n) = 1.
What you want is x^x^x^x mod 10. Say, 13^13^13^13. We can by elementary modulo arithmetic reduce the base mod 10, giving 3^13^13^13. By eulers theorem, we can reduce the exponent by phi(10) = 4 (do you understand this?). Thus we need to find 13^13^13 mod 4. Reducing base: 1^13^13=1, hence giving 13^13^13^13=3^1=3 mod 10.
But, if x is not relatively prime to 10, or phi(10), etc.. you must do some other tricks. Say you want to find 5^5^5^5 mod 10. You can however in this case use that 5^n = 5 mod 10 for all n, hence 5^5^5^5 = 5. This works for any multiple of 5. You can do the even numbers for yourself.
Just try to reduce as much as you can. Finding the last digit is almost always very easy.