In the proof of the expectation of the binomial distribution,
$$E[X]=\sum_{k=0}^{n}k \binom{n}{k}p^kq^{n-k}=p\frac{d}{dp}(p+q)^n=pn(p+q)^{n-1}=np$$
Why is $\sum_{k=0}^{n}k \binom{n}{k}p^kq^{n-k}= p\frac{d}{dp}(p+q)^n$?
I know that by the binomial theorem $(p+q)^n=\sum_{k=0}^{n}\binom{n}{k}p^kq^{n-k}$.
You're missing the sum over $k$ in the binomial theorem. If you add it and perform the differentiation and multiplication termwise, you'll get the desired result.