How to prove $|a^k|=n/\gcd(n,k)$ whenever $|a|=n$?
You have two things to show. Namely that:
- $(a^k)^{n/\gcd(n,k)}=e$ (where $e$ denotes the identity)
and that $n/\gcd(n,k)$ is the smallest positive power $p$ of $a^k$ such that $(a^k)^p=e$:
- For all $m>0$: $(a^k)^m=e \implies n/\gcd(n,k)\leq m$
The first part is easy:
$$ (a^k)^{n/\gcd(n,k)}=(a^n)^{k/\gcd(n,k)}=e^{k/\gcd(n,k)}=e $$
For the second part, let $m\in\mathbb{N}$ be such that $(a^k)^m=a^{km}=e$. Since the order of $a$ is $n$, it follows that $n\mid km$. Therefore we also have
$$ \frac{n}{\gcd(n,k)}\mid \frac{k}{\gcd(n,k)}m $$
Now $\gcd(n/\gcd(n,k),k/\gcd(n,k))=1$ (try to prove this), so it follows that
$$ n/\gcd(n,k)\mid m $$
Hence in particular $n/\gcd(n,k)\leq m$.
The order of $a^k$ is the smallest $r>0$ such that $a^{kr}=e$, i.e. such that $kr$ is a multiple of the order $n$ of $a$. This means $kr$ is the least common multiple of $k$ and $n$.
As $\operatorname{lcm}(k,n)=\dfrac{kn}{\gcd(k,n)}$, we have: $\quad r=\dfrac{n}{\gcd(k,n)}.$
The proof is simpler (and more general) if we use basic gcd / lcm laws vs. Bezout gcd identity.
Lemma $\ \ (a^{\large k})^{\large j}\! = 1\color{#90f}{\underset{a^n\,=\,1}\Longleftarrow}\!\!\!\!\!\color{#0a0}{\overset{{\rm ord}\,a\,=\,n}{\Longrightarrow}} n/(n,k)\mid j\,.\ \ \ $ Proof:
$$ (a^{\large k})^{\large j}\! = 1\color{#90f}{\underset{a^n\,=\,1}\Longleftarrow}\!\!\!\!\!\color{#0a0}{\overset{{\rm ord}\,a\,=\,n}{\Longrightarrow}} n\mid kj\!\iff\! n\mid nj,kj\!\color{#c00}\iff\! n\mid(nj,kj)\!=\!(n,k)j\!\iff\! n/(n,k)\mid j\qquad$$
$\,\color{#0a0}{\rm First\ (\Rightarrow)}\,$ is by $\,n = {\rm\ ord}\, a,\,$ $\rm\color{#c00}{third}$ by the definition/universal property of the gcd and the gcd distributive law. $\,\color{#90f}{\rm Note}$ that the proof of the $\color{#90f}{(\Leftarrow)}$ chain needs only that $\,\color{#90f}{a^n =1},\,$ not $\,\color{#0a0}{{\rm ord}\,a = n},\,$ i.e. $\,a^n = 1\,\Rightarrow\, (a^k)^{n/(n,k)} = 1,\,$ or a direct proof, by writing the expt as $\,n\:\!(k/(n,k))\:\!$.
Alternatively we can use lcm instead of gcd, using notation $\,[x,y] :={\rm lcm}(x,y),$
$$ (a^{\large k})^{\large j} = 1\iff n\mid kj\iff n,k\mid kj\iff [n,k]\mid kj\iff [n,k]/k\mid j\qquad$$
Both proofs are equivalent since $\ [n,k]/k = n/(n,k),\ $ i.e. $\ [n,k](n,k) = nk,\,$ by here.
Corollary $\ \ \bbox[5px,border:1px solid #c00]{{\rm ord}(a) = n\,\Rightarrow\,{\rm ord}(a^{\large k}) = \dfrac{n}{(n,k)} = \dfrac{[n,k]}k}\ $ since, generally,
$\qquad\qquad\quad b^{\large j} = 1\iff i\mid j\ $ is equivalent to $\,b\,$ has order $\,i.\,$