Binomial distribution, given the number of success, what is the expected total number of trials? For a random variable that follows binomial distribution, $X|N=n\sim Binomial(n,p)$.
What is the expectation of $N$ when we know the value of the random variable but don't know the total? ie. What is $E[N|X=k]$? 
Do we need to know the distribution of $N$ first? If so, please assume $N\sim Pois(\lambda)$
Note: I am not sure if my notation is entirely correct
 A: The marginal (unconditional) distribution of $X$ under this hierarchical model is $$\begin{align*} \Pr[X = k] &= \sum_{n = k}^\infty \Pr[X = k \mid N = n]\Pr[N = n] \\ &= \sum_{n=k}^\infty \binom{n}{k} p^k (1-p)^{n-k} e^{-\lambda} \frac{\lambda^n}{n!} \\ &= \frac{(p\lambda)^k e^{-\lambda}}{k!} \sum_{n=k}^\infty \frac{((1-p)\lambda)^{n-k}}{(n-k)!} \\ &= \frac{(p\lambda)^k e^{-\lambda}}{k!} e^{(1-p)\lambda} = e^{-p\lambda} \frac{(p\lambda)^k}{k!},\end{align*}$$ where we note that the lower index of summation starts at $n = k$ since if we have observed $X = k$, it is not possible for $N < X$.  Furthermore, we have also used the fact that $$e^z = \sum_{m=0}^\infty \frac{z^m}{m!}.$$  From this, we deduce that the marginal distribution of $X$ is Poisson with parameter $p\lambda$.  Consequently, $$\begin{align*} \Pr[N = n \mid X = k] &= \frac{\Pr[X = k \mid N = n]\Pr[N = n]}{\Pr[X = k]} \\ &= \binom{n}{k} p^k (1-p)^{n-k} e^{-\lambda} \frac{\lambda^n}{n!} e^{p\lambda} \frac{k!}{(p\lambda)^k} \\ &= e^{-(1-p)\lambda} \frac{((1-p)\lambda)^{n-k}}{(n-k)!}, \quad n \ge k,\end{align*}$$ which is a location-transformed Poisson (note the support is on $\{k, k+1, k+2, \ldots\}$), but with parameter $(1-p)\lambda$.  That is to say, $N \mid X = X + N^*$ where $N^*$ is Poisson.  Thus the posterior expectation of $N$ given a Poisson prior is $$\operatorname{E}[N \mid X = k] = k + \operatorname{E}[N^*] = k + (1-p)\lambda.$$  This result makes some intuitive sense:  the posterior expectation must be at least $k$ (since you observed $k$ successes in $N$ trials, $N \ge k$).  Also, the larger the prior rate hyperparameter $\lambda$, the larger your posterior belief in the total number of trials, whereas if the success probability is high, you should be proportionally less influenced by $\lambda$ than you would be if the success probability $p$ is low, because the more successes you observe in a process where the success probability is low, the more you will have to "inflate" your posterior belief of the total number of trials that were conducted in order to have observed those successes.
A: This can be realized with a compound Poisson distribution.  Each occurrence, independently, is a "success" with probability $p$ and otherwise a "failure"; the number of occurrences is a Poisson$(\lambda)$ random variable, and $X$ is the total number of successes.  The successes and failures can also be considered as two separate independent Poisson random variables, with parameters $\lambda p$ and $\lambda (1-p)$ respectively.
The expected number of failures is then $\lambda (1-p)$.  Given the number of successes is $x$, the expected number of failures is still $\lambda (1-p)$ (since successes and failures are independent), and the number of occurrences is the sum of the numbers of successes and failures.  Thus
$$ E[N | X = x] = x + \lambda (1-p)$$
A: Your question is not well posed. When you specify $X \sim \text{Binomial}(n,p)$ you are telling us what $n$ is. It is a fixed constant, not a random variable. In that sense, $E[n] = E[n|\text{anything}] = n$.
A: So two things:
One would be that, given $n$, you would expect $np$ successes, so if you were to "invert" this process, I suppose you might say you expect you had $\frac{k}{p}$ trials.  However, I have my doubts as to this reasoning being legitimate.
The other is that you could analyze this numerically - i'm quite certain there wouldn't be a closed-form solution - using Bayesian statistics.  You would have to multiply the Likelihood of $k$ given $n$ ($\Pr(X=k|n)$) to your prior distribution for $n$ (something with only positive integers in its domain), and then use that function to write a metropolis sampler to simulate random draws from the distribution which is proportional to that function.  Then from those random draws, which approximate the true distribution, you could find a mean.  I'm guessing this isn't the kind of answer you're looking for, but if you are familiar with Bayesian methods, it might be interesting to try out.
