I've searched this website and while there are a few questions similar to mine, I couldn't find what I was looking for/a specific method for what I want to do.
I want to understand how one would prove that the remainder of $5^{336}$ by $23$ is $8$, or in other words, $$5^{336}\equiv 8 \pmod{23}.$$
Can anyone help me understand how one would approach a problem like this?
$23$ is prime, so $\phi(23) = 22$. You can thus always take the exponent modulo $22$ (by Euler's theorem, or in this special case Fermat's little theorem). $$5^{336} \equiv 5^6 \equiv 2^3 = 8 \pmod{23}$$ The last congruence is because $5^2 = 25 \equiv 2$
Remark on Brute-Forcing
We actually have $\mathrm{ord}_{23}(5) = 22$ so you'd have to do many computations until you arrive there. This is highly impractical.
Remark on modulus in exponents
We know that $$a^{\mathrm{ord}_n(a)}\equiv 1 \pmod n$$ by definition of the order of an element. Also we know that the order of an element is a divisor of the group order, alas $\mathrm{ord}_n(a) | \phi(n)$. This allows us to make two statements: $$a^k \equiv a^{k\bmod \mathrm{ord}_n(a)} \pmod n$$ and as a corollary of that, $a^k \equiv a^{k\bmod \phi(n)} \pmod n$.