# probability – Learning how summations work

Before, I begin I want say that the original question asks, “A couple decides to continue to have children until a daughter is born. What is the expected number of children until a daughter is born?”

Below, is the solution that they had in the back of the textbook (Statistical Inference, Second Edition, Roger L. Berger, George Casella)

What I do not understand is how to deduce summations that well.

First of all, how do they get
$$sum^infty_{k=1}k(1-p )^{k-1}p = p – sum^infty_{k=1}frac{d}{dp}(1-p )^{k}$$

Next, How do they simplify this as well $$-pfrac{d}{dp}{bigg(sum^infty_{k=0}(1-p)^k-1bigg)} = -pfrac{d}{dp}bigg(frac{1}{p}-1bigg) = frac{1}{p}$$

I would like this to be shown and explained intuitively because the statistics course I am taking requires me to be able to deduce summations on my own, and it seems to be a huge part of understanding the subject. Thank you ahead of time.