Consider a binomial distribution $$p(n_1)={}^NC_{n_1} p^{n_1}q^{N-n_1}$$ As per my text the moments can be found as $$p^{n_1}n_1^{m}=\left( p\frac{\partial }{\partial p}\right)^mp^{n_1}$$ \begin{align*} \langle n_1^m\rangle &= \sum_{n_1}{}^NC_{n_1} p^{n_1}q^{N-n_1} n_1^{m} \\ &= \sum_{n_1}{}^NC_{n_1} \left( p\frac{\partial }{\partial p}\right)^mp^{n_1}q^{N-n_1} \\ &= \left( p\frac{\partial }{\partial p}\right)^m\sum_{n_1}{}^NC_{n_1} p^{n_1}q^{N-n_1} \\ &= \left( p\frac{\partial }{\partial p}\right)^m(p+q)^N \end{align*}
Now what they do, is to act the derivatives one by one and then in the final result use $p+q=1$. In this stack post I have asked given $p+q=1$ How do we find the derivative, Most have suggested putting the value of $p+q=1$in the function but if we do so every moment come out to be zero. So Can any explain this reason for the flaw?