Conceptually, by below: $\,k\!=\!p\,$ is coprime to $\color{#0a0}{f= p^n\!-\!1}\,$ so we can take $p$'th roots: $\,g = (g^{1/p})^p$.
Theorem $ $ [Compute $k$'th root by raising to power $\frac{1}k\!\pmod{\!f}\,$ if $\,k\,$ is coprime to $\color{#0a0}{{\rm period}\ f}$]
Suppose that $\ \color{#0a0}{a^f} = 1 = \color{#0a0}{b^f},\ $ and that $\ \color{#c00}{1/k}_f:= k^{-1}\equiv k'\pmod{\!f},\, $ so $\, \color{#90f}{kk'} = 1 \!+\! jf.\, $ Then
$$ \bbox[10px,border:1px solid #c00]{\large a^{\large\color{#c00} k}= b \iff a = b^{\large (\color{#c00}{1/k})_{f}} }\qquad\qquad$$
Proof $\ (\Rightarrow)\ \ \ b = a^{\large k}\,\Rightarrow\, b^{\large k'}\! = a^{\large\color{#90f}{kk'}}\! = a^{\large 1+fj} = a(\color{#0a0}{a^{\large f}})^{\large j} = a.\ $ $(\Leftarrow)\ $ Same way $\ (a = b^{\large k'})^{\large k}$
Remark $ $ The proof was excerpted from this answer in an elementary number theory context (which might prove helpful as motivation). If you have good knowledge of (cyclic) groups then you may find it instructive to polish it in that language.