Suppose that $a,p$ are nonnegative integers such that $p$ is prime and $p\nmid (a-1)$. If $(a-1)^{p+1}+a^p=(a+1)^{p-1}$, find the sum of all possible values of $a$.
We can't have $p = 2$ since the equation $$(a-1)^3+a^2 = (a+1)$$ has no integer solutions. We now take two cases:
Case 1: $p \mid (a+1)$
In this case, $a \equiv -1 \pmod{p}$. Then $(a-1)^{p+1} \equiv (-2)^{p+1} \equiv 4 \equiv -a^p \equiv -a \pmod{p}$. Thus $a \equiv 4 \pmod{p}$ and therefore $p \mid 3$, so that $p = 3$. Thus $a = 2$ in this case.
Case 2: $p \nmid (a+1)$
We have $$(a-1)^{p+1}+a^p \equiv (a-1)^2+a^p \equiv 1 \pmod{p}.$$ If $a \not \equiv 0 \pmod{p}$, then we have $(a-1)^2+a \equiv 1 \pmod{p}$, which gives $a(a-1) \equiv 0 \pmod{p}$. Thus $p \mid (a-1)$, a contradiction. Thus $a \equiv 0 \pmod{p}$.
How do I continue from here?
Hint $$1 \geq \frac{(a-1)^{p+1}}{(a+1)^{p-1}}=(a-1)^2 (1-\frac{2}{a+1})^{p-1}\geq (a-1)^2 (1-\frac{2(p-1)}{a+1})$$ with the last inequality following by Bernoulli.
Thus $$a+1 \geq (a-1)^2(a+3-2p) \\ 2 =a+1-(a-1)\geq a+1-(a-1)^2\geq (a-1)^2(a+2-2p)$$
This implies that either $(a+2-2p) \leq 0$ or $a-1=1$ and $(a+2-2p) \in \{ 1,2 \}$.
Combine this with $p|a$ to complete the proof.
Added If $a=p \geq 3$ then $$(p-1)^{p+1}+p^p=(p+1)^{p-1}$$
and hence $$(p-1)^{p+1}+p^p=(p+1)^{p-1} \pmod{p^3} \\ \binom{p+1}{2}p^2(-1)^{p-1}+\binom{p+1}{1}p(-1)^p+(-1)^{p+1}=\binom{p-1}{2}p^2+\binom{p-1}{1}p+1\pmod{p^3} \\ \frac{(p+1)p}{2}p^2-(p+1)p+1= \frac{(p-1)(p-2)}{2}p^2+(p-1)p+1 \pmod{p^3} \\ -p^2-p+1= p^2+p^2-p+1 \pmod{p^3} \\ 3p^2=0 \pmod{p^3} \\ $$
This shows $p=3$. The case $p=2$ is easy to study separately.