Sure, here is the translated text:

```
II. (40 points) Find all prime numbers $p$ such that
$$
p^{2} \mid \sum_{k=1}^{n-1} k^{2 p+1} .
$$
```
Due to $2^{2}+1$, $p=2$ does not satisfy the condition. Hereafter, let $p$ be an odd prime.
For $k=1,2, \cdots, \frac{p-1}{2}$, by Fermat's Little Theorem, we have $k^{2 p} \equiv k^{2}(\bmod p)$.
Thus, $k^{2 p+1}+(p-k)^{2 p+1}$
$\equiv k^{2 p+1}+(2 p+1) p k^{2 p}-k^{2 p+1}$
$\equiv p k^{2 p} \equiv p k^{2}\left(\bmod p^{2}\right)$.
Summing up, we get
$\sum_{k=1}^{p-1} k^{2 p+1} \equiv p \sum_{k=1}^{\frac{k-1}{2}} k^{2}=p^{2} \cdot \frac{p^{2}-1}{24}\left(\bmod p^{2}\right)$.
$p^{2} \mid \sum_{k=1}^{p-1} k^{2 p+1}$ if and only if $24 \mid \left(p^{2}-1\right)$.
Clearly, $p \neq 3$.
For $p \geqslant 5$, $p^{2}-1=(p+1)(p-1)$ is necessarily a multiple of 3 and 8, hence $24 \mid \left(p^{2}-1\right)$.
In summary, the required $p$ is all primes greater than 3.