My thought process is: $X$ can only take on values greater than or equal to $n$. (Clearly, we cannot get $n$ heads in less than $n$ flips.) If $X=n$, that means every flip was a head, so this occurs with probability $p^n$. If $X=n+1$, this means there were $n$ heads and $1$ tail, and the tail can be at any one of the first $n$ spots. (It cannot be the $n+1$-th flip as then $X=n$.) So this occurs at probability $(1-p)p^n\binom{n}{1}$. By similar logic, $X=n+k$ with probability $(1-p)^kp^n\binom{n+k-1}{k}$. So we get $$\mathbb{E}(X) = p^n\sum_{k=0}^\infty (n+k)(1-p)^k\binom{n+k-1}{k}.$$
Intuitively, I want to get the number $n/p$ but how to get this from my sum?
Coming up heads with probability $p$ means that in $N\,$ flips we get $n=pN\,$ heads, so $N=n/p$.