For simplicity let's enumerate the statements.
(1) (1n−1+2n−1+⋯+(n−1)n−1)+1 is divisible by n
(2) pn−1 divisible by p and pn−1 divisible by p−1
Let n=Ap. Firstly, observe that
k=1∑n−1kn−1≡{−A0(mod p),(mod p),if n−1 is divisible by p−1,if n−1 is not divisible by p−1
The first case is clear, it follows from Fermat's little theorem. And the second can be shown, for instance, as follows: let g be a primitive root by modulo p, then
k=1∑p−1kn−1≡k=1∑p−1(gk)n−1≡gn−1k=1∑p−1kn−1(modp)
and gn−1≡1(modp) implies that ∑k=1n−1kn−1≡0(modp).
Suppose that (1) holds. Then either n−1 divisible by p−1 and A−1 divisible by p, or n−1 divisible by p−1 and 1 divisible by p. Therefore, n−1 divisible by p−1 and A−1 divisible by p. Hence, n−1=(p−1)A+A−1 divisible by p−1⇒A−1 divisible by p−1, we obtain (2).
Now suppose that (2) holds. A−1 divisible by p⇒n is not divisible by p2, so n is squarefree. A−1 divisible by p−1⇒p(A−1)=n−1−(p−1) divisible by p−1⇒n−1 divisible by p−1. Therefore,
1+k=1∑n−1kn−1≡1−A≡0(modp),
since A−1 divisible by p. Because this holds for every prime divisor p of n, and n is squarefree, using the Chinese Remainder Theorem, we obtain (1).