Another scenario, to provide a different perspective
A jar contains five marbles, one white and four black.
I perform an experiment of three draws from the jar, putting the marble back after each draw, aka sampling with replacement.
- Let a try be one draw of a marble from the jar of five marbles
- Let success be the probability the drawn marble was white, and failure be 1 - success
- Let risk be the probability of running the entire experiment of three tries and not getting a white marble outcome, and confidence be 1 - risk
This is a Bernoulli trial where there are two possible outcomes each try, and three tries, so there are a total of 2^3 = 8 possible outcomes to the experiment.

Of these eight possible outcomes, only the last one (Outcome #8 in the table) results in failure on all three tries. And the risk of this experiment resulting in outcome #8 can be calculated just like any of the outcomes as the product of it's component parts:
risk = (4/5) × (4/5) × (4/5) = (4/5)^3 = 0.512
The neat part of this is that we can represent the probability risk in the compact form (4/5)^3. The two component parts of this expression are (4/5) → failure and 3 → tries. So we can restate the above equation as:
risk = failure ^ tries
And from there we can re-arrange the formula so that given any two variables we can calculate the third
risk = failure ^ tries
tries = log(risk) / log(failure)
failure = risk^ (1/tries)
So in this scenario we were able to calculate confidence (1-risk) as a function of the probability of success (1-failure) each try and the number of tries.