Example 3.19 in the 9th edition of Probability and Statistics by Jay Devore is about expected value and has the following equations:
$$ p(x) = \begin{cases} p(1-p)^{x-1}\ \ x=1,2,3,...\\ 0\ \ \text{otherwise} \end{cases} $$ and $$ E(X)=\sum_{D}x\cdot{p(x)}=\sum_{x=1}^{\infty}xp(1-p)^{x-1}=p\sum_{x=1}^{\infty}\big{[}-\frac{d}{dp}(1-p)^x\big{]} $$
Where is the derivative coming from in the right-hand side of the second equation?
Working out the derivative inside the sum, $$p\sum_{x=1}^\infty-\frac{d}{dp}(1-p)^x,$$ we obtain $$p\sum_{x=1}^\infty-\left(-x(1-p)^{x-1}\right).$$ Expanding the bracket and simplifying gives $$\sum_{x=1}^\infty px(1-p)^{x-1},$$ and since $px=xp$ you get the equality as written.