I understand the first part (2^4 is 1 mod 5), but how can you extend this to 2^2^2022?
\(2^4 \equiv 1 \pmod{5}\), so \(2^{2^{2022}} \equiv 1 \pmod{5}\)
You can use modular arithmetic.