<s>[INST] Prove that numerator of fraction $\sum \limits_{k=1}^{p-2}\frac{k}{(k+1)^2}$ is divisible by $p$ for all prime $p>3$ Let $p>3$ be a prime number. Let $\sum \limits_{k=1}^{p-2}\frac{k}{(k+1)^2}=\frac{r}{s}$, where $r,s$ are some integers numbers. Prove that $r$ is divisible by $p$.
My work. Let $\sum \limits_{k=1}^{p-1}\frac{1}{k}=\frac{a}{(p-1)!}$. Then $\sum \limits_{k=1}^{p-1}\frac{1}{k}=\sum \limits_{k=1}^{\frac{p-1}{2}}\left(\frac{1}{k}+\frac{1}{p-k} \right)=\sum \limits_{k=1}^{\frac{p-1}{2}}\frac{p}{k(p-k)}$. Then $a$ is divisible by $p$. Let $\sum \limits_{k=1}^{p-1}\frac{1}{k^2}=\frac{b}{((p-1)!)^2}$. Then $\frac{r}{s}=\sum \limits_{k=1}^{p-2}\frac{k}{(k+1)^2}=\sum \limits_{k=1}^{p-2} \left( \frac{1}{k+1}-\frac{1}{(k+1)^2}\right)=\sum \limits_{k=1}^{p-1}\frac{1}{k}-\sum \limits_{k=1}^{p-1}\frac{1}{k^2}=\frac{a}{(p-1)!}-\frac{b}{((p-1)!)^2}=\frac{a(p-1)!-b}{((p-1)!)^2}$. Since $a$ is divisible by $p$, we need to prove that $b$ is divisible by $p$.
 [/INST] Note that $$\sum_{k=1}^{p-2} \frac{k}{(k+1)^2} =  \sum_{i=2}^{p-1} \frac{1}{i} - \frac{1}{i^2} = \sum_{i=1}^{p-1} \frac{1}{i} - \frac{ 1}{i^2}. $$ 
We work mod $p$.   


*

*$ \{ \frac{1}{i} | i = 1\text{ to }p-1\} = \{ j | j = 1\text{ to }p-1\}$.
Hence $ \sum \frac{1}{i} = \sum j  =  \frac{p(p-1)}{2} \equiv 0\pmod{p}$ for $ p > 2$.      

*$ \{ \frac{1}{i^2} | i = 1\text{ to }p-1\} = \{ j^2 | j =1\text{ to }p-1\}$.
Hence $\sum \frac{1}{i^2} = \sum j^2 = \frac{ p(p-1)(2p-1)}{6} \equiv 0 \pmod{p}$ for $p>3$.   


Hence, $\sum_{k=1}^{p-2} \frac{k}{(k+1)^2} \equiv 0 \pmod{p}$, which means that the numerator is a multiple of $p$ for $p > 3$.   

And yes, the equations generalize to higher powers. You just have to be careful with the denominator that appears in $\sum j^n$. By the method of differences, we know the denominator is factor of $(n+1)!$, hence the equation holds for $p > n+1$ (and possibly some other cases).      
</s>