If you multiply $a$ multiplied by itself $m-1$ times by the inverse of $a$, you get.... $a$ multiplied by itself $m-2$ times and then $1$ more time and then by the inverse of $a$,... which is $a$ multiplied by itself $m-2$ times and then multiplied by $a$ times the inverse of $a$... which is $a$ multiplied by itself $m-2$ times and then multiplied by $1$ .... which is $a$ multiplied by itself $m-2$ times.
Yes, it is notation but because of the identity nature of of $1$, the associativity of multiplication, and the meaning of the inverse, those are all legitimate results.
$a^{m-1} \equiv 1 \pmod m$
$a^{m-1}*a^{-1} \equiv a^{-1} \pmod m$
$\underbrace{a*a*a*...*a*a}_{m-1\text{ times}}*a^{-1} \equiv a^{-1} \pmod m$
$\underbrace{a*a*a*...*a}_{m-2\text{ times}}*\underbrace{a}_{1\text {time}}*a^{-1} \equiv a^{-1} \pmod m$
$\underbrace{a*a*a*...*a}_{m-2\text{ times}}*\underbrace{a*a^{-1}} \equiv a^{-1} \pmod m$
$\underbrace{a*a*a*...*a}_{m-2\text{ times}}*\underbrace 1 \equiv a^{-1} \pmod m$
$\underbrace{a*a*a*...*a}_{m-2\text{ times}} \equiv a^{-1} \pmod m$
$a^{m-2} \equiv a^{-1} \pmod m$.
====
Claim 1: $a^k*a^{-1} = a^{k-1}$ for any algebraic structure where $a^{-1}$ exists.
Pf: The same as above.
Claim 2: $(a^m)^{-1} = (a^{-1})^m$ and therefore we can define the natation $a^{-m} := (a^m)^{-1} = (a^{-1})^m$.
Pf: $(a^m)^{-1}$ is the element $k$ where $(a^m)*k = 1$.
And $(a^m)*(a^{-1})^m = \underbrace{a*\underbrace{a*\underbrace{a ...*\underbrace{a*a^{-1}}*... *a^{-1}}*a^{-1}}*a^{-1}}=$
$\underbrace{a*\underbrace{a*\underbrace{a ...*1*... *a^{-1}}*a^{-1}}*a^{-1}}=$
$...$
$\underbrace{a*\underbrace{a*\underbrace{a*a^{-1}}*a^{-1}}*a^{-1}}=$
$\underbrace{a*\underbrace{a*1*a^{-1}}*a^{-1}}=$
$\underbrace{a*\underbrace{a*a^{-1}}*a^{-1}}=$
$\underbrace{a*1*a^{-1}}=$
$\underbrace{a*a^{-1}}=1$
So $(a^m)^{-1} = (a^{-1})^m$.
Claim 3:
$a^ma^{-k} = a^{m-k}$.
Pf: Too similar to the above to bear repeating.