I have doubts on the same question
First, What is k here?
Second, I know E[X]= E[I{A}], I define indicator random variable. We can say that I{A} is the indicator random variable of geometric distribution. Now, I{A} depend upon probability of success and failure. So I{A} = 1.pr{Success} + 0. pr{failure}. However, from the 1st line of derivation I cannot understand where 1.pr{Success} + 0. pr{failure} is used.
3rd, from where we appear in the 3rd line of the calculation?
if it is coming from geometric summation then the geometric summation for infinite series is
$$\displaystyle\sum\limits_{k=0}^\infty x^k = \left(\frac{1}{1-x}\right)$$
Then It should be $$\left(\frac{p}{q}\right)\left(\frac{1}{1-q}\right)$$