Trying to solve the modular equation $$x \equiv 58^{5745} \pmod{59}$$
I've seen a solution to this that involves using that $58 \equiv (-1) \pmod{59}$, and this in turn means that $58^{5745} \equiv (-1)\pmod{59}$, but I'm missing the rule that explains this step.
Can someone clarify?