Given a Bernoulli trial with probability of success p and a number of trials x, what is the expected number of trials until success in a case success was achieved in x trials? It is assumed that after a successful attempt, the single experiment ends and no further trials are taken.
e.g. if p = 0.02 and x = 60, I would like to find the expected number of trials taken in case success was obtained 60 trials. Indeed there is a chance to fail all 60, but I'm interested, for the case of success within 60 trials, in the average/expected number of trials it takes. I understand it is lower than 1/0.02 and decreases with x.
The waiting time to the first success is geometrically distributed: $$ P(T\le t) = 1-(1-p)^{t}.$$ You are interested in conditioning on $T\le 60,$ so for $t\le 60,$ we have $$ P(T\le t\mid T\le 60) = \frac{P(T\le t,T\le 60)}{P(T\le 60)} = \frac{P(T\le t)}{P(T\le 60)} =\frac{1-(1-p)^{t}}{1-(1-p)^{60}},$$ and differencing gives $$ P(T=t\mid T\le 60) = \frac{p(1-p)^{t-1}}{1-(1-p)^{60}}.$$ Thus, $$ E(T\mid T\le 60) = \frac{p}{1-(1-p)^{60}}\sum_{t=1}^{60}t(1-p)^{t-1}.$$
This sum can be done in closed form using a standard trick $$ \sum_{t=1}^{60}tz^{t-1}= \frac{d}{dz}\sum_{t=1}^{60} z^t = \frac{d}{dz}\frac{z-z^{61}}{1-z}=\frac{z-z^{61}}{(1-z)^2}+\frac{1-60z^{59}}{1-z}$$ so taking $z=1-p,$ we have $$ E(T\mid T\le 60) = \frac{1-z}{1-z^{60}}\left(\frac{z-z^{61}}{(1-z)^2}-\frac{1-61z^{60}}{1-z}\right) = \frac{1-p}{p} + \frac{1-61(1-p)^{60}}{1-(1-p)^{60}}\\= \frac{1}{p}- \frac{60(1-p)^{60}}{1-(1-p)^{60}}$$