The formula for finding the probability depends on the random experiment you have.

If the set of possible outcomes (sample space) is a finite set and the outcomes are equally likely, you can use the classical definition of probability which is the ratio of favourable no. of outcomes to the total no. of outcomes in the sample space.

But if the sample space cotains infine no. of elements, you have to use other methods to find the probability.

p(1-p)^(x-1) means (1-p)*(1-p)*(1-p)....(x-1) times * p.