Let $p$ be an odd prime and let $1\leq n
Remark: It seems one can not apply Fermat's little theorem directly as $n
Let $p$ be an odd prime and let $1\leq n
Remark: It seems one can not apply Fermat's little theorem directly as $n
We might as well sum to $p-1$. Let $g$ be a primitive root of $p$. Then $1$, $2$, $3$, and so on up to $p-1$ are congruent, in some order, to $g^0$, $g^1$, up to $g^{p-2}$. So modulo $p$ the terms in our sum are congruent to $g^0$, $g^n$, $g^{2n}$, up to $g^{(p-2)n}$. Sum this geometric progression. We get $\dfrac{g^{(p-1)n}-1}{g^n-1}$. The numerator is congruent to $0$. There is no problem with the denominator, since $n\lt p-1$.
If one prefers not to use fractions, equivalently note that $\left(1+g^n+g^{2n}+\cdots+g^{(p-2)n}\right)(1-g^n)=1-g^{(p-1)n}.$ The right-hand side is congruent to $0$. But $1-g^n$ is not congruent to $0$, and the result follows.
Since the sets of reduced residue classes $\{1, 2, . . . , (p ā 1)\}$ and $\{g, 2g, . . . , (p ā 1)g\}$ are the same if $(g,p)=1$ the reason being: if $r_1g\equiv r_2g\pmod p,$ where $1\le r_1< r_2\le p-1$ $\implies r_1\equiv r_2$ which is impossible, so $r_1gā¢r_2g\pmod p$.
So, $\sum_{1\le x\le p-1} x^n \equiv \sum_{1\le y\le p-1} (gy)^n \pmod p$
$\implies p\mid(g^n-1){\sum_{1\le x\le p-1} x^n }$
If we take $g$ to be a primitive root, $p\mid (g^n-1)\iff \phi(p)=(p-1)\mid n$
Since $1\le n
If $(p-1)\mid n, \sum_{1\le x\le p-1} x^n\equiv \sum_{1\le x\le p-1}1\pmod p=p-1\equiv -1\pmod p $
Call $ p_n = \sum_{k=1}^{p} k^n. $ Since, by Fermat's little theorem, $p_n\equiv p_{n-p+1}\pmod{p}$ for all $n > p-1$, it is sufficient to show that $ \forall n\in[0,p-2],\quad p_n\equiv 0\pmod{p}, $ where the cases $n=0$ and $n=1$ are trivial. Since: $ x(x-1)\cdot\ldots\cdot(x-p+1)\equiv x^p-x\pmod{p}, $ if $e_k(x_1,\ldots,x_p)$ is the $k$-th elementary symmetric polynomial, we have: $ \forall k\in[0,p-2],\quad e_k(1,\ldots,p)\equiv 0\pmod{p}, $ so, in virtue of Newton-Girard identities and induction we have: $\forall k\in[0,p-2],\quad p_k\equiv 0\pmod{p}, $ QED.
EDIT:This is a wrong answer($r^n \equiv t^n \pmod p \not \Rightarrow r \equiv t \pmod p$). See the comments.
For $n=1$ is correct.
Now for any $n \in \{1,2,\ldots,p-2\}$ we have that $\{1,2,\ldots,p-1\}\equiv \{1,2^n,\ldots,(p-1)^n\} \pmod p$ since $r^n \equiv t^n \pmod p \iff r \equiv t \pmod p$. Hence $\sum_{t=1}^{p}t^n \equiv \sum_{t=1}^{p}t \equiv 0 \pmod{p} .$
WLOG assume $nk = p-1$ (if $n$ had factors coprime to $p-1$ they would just permute the sum, not change it's value, so remove them).
Put $S = (\mathbb Z/p\mathbb Z)^\times$ and let $S^n$ denote the subgroup $\{ s^n \in S | s \in S \}$. The kernel of the map $S \to S^n$ is the set of solutions of $z^n=1$ so $n|S^n| = |S|$. Details about subgroup here
This tells us that (mod p) the sum is equal to $n$ times the sum of the elements of $S^n$ so we just need to show that $\sum_{s \in S^n}s \equiv 0 \pmod p$ but since this is the set of solutions of $z^n-1=0$ by Vieta's formula they sum to $0$.