Is my shorter expression for $ s_m(n)= 1^m+2^m+3^m+\cdots+(n-1)^m \pmod n$ true?

Since the sets of reduced residue classes $\{1, 2,\cdots, (n − 1)\}$ and $\{g, 2g,\cdots, (n − 1)g\}$ are the same if $(g,n)=1$,

then $g^m\cdot s_m(n)≡\sum_{1\le j\le n-1}(g\cdot j)^m≡\sum_{1\le k\le n-1}k^m≡s_m(n)\pmod n$.

So, $n\mid (g^m-1) s_m(n)\implies s_m(n)\equiv \frac{n}{(n,g^m-1)}\pmod n$

So if $(g^m-1,n)=1,s_m(n)\equiv 0\pmod n$

If $g$ is so chosen that $ord_ng$ is maximum=$\lambda(n)$, i..e, $g$ is a primitive $\lambda$ root, where $\lambda(n)$ is the Carmichael Function.

if $\lambda(n)\mid m, j^m\equiv 1\pmod n$ if $1\le j<n\implies s_m(n)≡n-1\pmod n$

if $n$ has a primitive root, i.e., $n$ is of the form $2,4,p^k,2p^k,$ then $(ord_ng)_{max}=\phi(n)$ with $g$ is one of the primitive roots.

If $n$ is prime $=p$, then either $p\mid(g^m-1)$ or $(p,g^m-1)=1$

then, $(ord_pg)_{max}=\phi(p)=p-1$ with $g$ is one of the primitive roots.

if $m\mid(p-1), s_m(p)≡p-1\pmod p$

else $m\not\mid(p-1),(g^m-1,p)=1,s_m(p)\equiv 0\pmod p$


Hmm, that I didn't see that before: the question was, exactly in this form, already handled in a couple of articles on the Agoh-Giuga-conjecture; to mention for instance Borwein/Borwein/Borwein or Banks/Nevan/Pomerance which refer to a basic article on that matter by Bernd Kellner ("The Equivalence of Giuga's and Agoh's Conjectures") containing the proof for the heuristical identity which I stated in my question, using the stirling numbers. I've not yet understood that proof fully but it is a widely accepted one so I'll include its way of arguing here later when I got it correctly.