find the sum $\sum_{k=0}^{n} k\binom{n}{k}^2p^k$ I need to find the sum $$\sum_{k=0}^{n} \binom{n}{k}^2kp^k,$$ for an integer $n$ and $0<p<1$.
Mathematica would only return $$\sum_{k=0}^{n} k p^k \binom{n}{k}^2 = n^2 p \ _2F_1(1-n, 1-n, 2, p).$$ 
However, I would prefer a solution in terms of Legendre or Krawtchouk polinomials rather then a hypergeometric function.
 A: This one-year old answer was downvoted today. I ask the downvoter to explain what exactly makes this answer not useful.

The hypergeometric function you obtain can indeed be expressed in terms of Legendre polynomials.


*

*The differentiation formula
$$\frac{d}{dp}{}_2F_1(a,b,c,p)=\frac{ab}{c}{}_2F_1(a+1,b+1,c+1,p)$$
allows to write
$$_2F_1(1-n,1-n,2,p)=\frac{1}{n^2}\frac{d}{dp}{}_2F_1(-n,-n,1,p).\tag{1}$$

*On the other hand, one has Murphy's formula for Legendre polynomials:
\begin{align}P_n(z)&={}_2F_1\left(-n,n+1,1,\frac{1-z}{2}\right)=\\
&=\left(\frac{z+1}{2}\right)^n{}_2F_1\left(-n,-n,1,\frac{z-1}{z+1}\right).\tag{2}
\end{align}

*Now, combining (1) and (2), we get
$$_2F_1(1-n,1-n,2,p)=\frac{1}{n^2}\frac{d}{dp}\left[\left(1-p\right)^nP_n\left(\frac{1+p}{1-p}\right)\right],$$
so that finally
$$\boxed{\displaystyle\sum_{k=0}^n k p^k{n\choose k}^2=p\frac{d}{dp}\left[\left(1-p\right)^nP_n\left(\frac{1+p}{1-p}\right)\right]}\tag{3}$$

P.S. If you don't like the derivative in (3), you can express it in terms of $P_n$ and $P_{n-1}$ (or $P_{n+1}$) using the known differentiation formulas, e.g. the formula (44) here.

P.P.S. The formula (3) is an easy consequence of a simpler relation (known to Mathematica):
$$\sum_{k=0}^n p^k{n\choose k}^2=\left(1-p\right)^nP_n\left(\frac{1+p}{1-p}\right).
$$
