Calculating $E\left[\frac{r}{X}\right]$ where $X$ has a negative binomial distribution 
Performing a series of Bernoulli trials until $r$ (positive known integer) successes. Denote $p$ as the probability of success, $q = 1-p$ as the probability of failure and $X$ a random variable counts the number of trials that were performed. Calculate $E\left[\frac{r}{X}\right]$.

Steps I've done:
First I've noticed that $X\sim NB(r,p)$, giving $$E[X]=\sum_{k=r}^\infty k \times {k-1 \choose r-1} \times p^r \times q^{k-r}$$ 
Then $$E\left[\frac{r}{X}\right]=rE\left[\frac1X\right]=r\sum_{k=r}^\infty {\frac 1 k} \times {k-1 \choose r-1} \times p^r \times q^{k-r}$$
Next by manipulating the sum I could get:
$$r^2\times\sum_{k=r}^\infty {\frac 1 {k^2}} \times {k \choose r} \times p^r \times q^{k-r}$$ 
So it ends up calculating this sum, what I usually do is using the pascal's rule - ${n \choose k}={n-1 \choose k} + {n-1 \choose k-1}$ and try to derive a solution by recurrence relation and calculus tricks.
In the bottom line I couldn't get to the expected solution:
$$\sum_{k=1}^{r-1} (-1)^{k-1} \times {\frac r {r-k}} \times \left({ \frac p q  }\right)^k + \left(- {\frac p q}\right)^r r\ln(p)$$
 A: Rewrite the expectation as
$$E\left[\frac{r}{X}\right]=r\left(\frac pq\right)^r\underbrace{\sum_{k=r}^\infty \frac1k\binom{k-1}{r-1}q^k}_{g(q)}$$
The idea is to get to a expression for $g(q)$, assuming it is absolutely and uniformly convergent on $(0,1)$. Differentiating we have 
\begin{align}
g'(q)=\sum_{k=r}^\infty \binom{k-1}{r-1}q^{k-1}&=\sum_{j=0}^\infty \binom{r-1+j}{j}q^{r+j-1}\quad,\small\,j=k-r
\\&=\sum_{j=0}^\infty \frac{(r-1+j)_j}{j!}q^{r-1+j}
\\&=\sum_{j=0}^\infty \frac{(-r)_j(-1)^j}{j!}q^{r-1+j}
\\&=q^{r-1}\sum_{j=0}^\infty \frac{(-r)_j}{j!}(-q)^j
\\&=q^{r-1}\sum_{j=0}^\infty \binom{-r}{j}(-q)^j
\\&=q^{r-1}(1-q)^{-r}
\end{align}
Here we used basic results from https://en.wikipedia.org/wiki/Binomial_series.
Now by repeated application of integration by parts, 
\begin{align}
g(q)&=\int g'(q)\,dq+c
\\&=\int \frac{q^{r-1}}{(1-q)^r}\,dq+c
\\&=\frac{q^{r-1}}{(r-1)(1-q)^{r-1}}-\int \frac{q^{r-2}}{(1-q)^{r-1}}\,dq+c
\\&=\frac1{r-1}\left(\frac{q}{p}\right)^{r-1}-\left[\frac{q^{r-2}}{(r-2)(1-q)^{r-2}}-\int \frac{q^{r-3}}{(1-q)^{r-2}}\,dq\right]+c
\\&=\frac1{r-1}\left(\frac{q}{p}\right)^{r-1}-\frac1{r-2}\left(\frac{q}{p}\right)^{r-2}+\int \frac{q^{r-3}}{(1-q)^{r-2}}\,dq+c
\\&=\quad\vdots
\\&=\sum_{i=1}^{r-1}\frac{(-1)^{i-1}}{r-i}\left(\frac{q}{p}\right)^{r-i}+(-1)^r \int\frac{dq}{1-q}+c
\\&=\sum_{i=1}^{r-1}\frac{(-1)^{i-1}}{r-i}\left(\frac{q}{p}\right)^{r-i}+(-1)^r \ln(1-q)+c
\end{align}
Argue that the constant $c$ must be $0$ and you are done.
