Suppose that $P$ is the probability of landing heads up and also the $P$ variable is a uniform distribution in the interval $[0,1]$.
The question is how to find the probability of first $n$ heads in our total flips?
Suppose $n=5$:
The probability of 5 heads is $p^5$. But I don't know how to find the numeric value of this probability:
Should I do something like?
$$value = \int_{0}^{1}p^5dp $$
To avoid confusion in notation I will write $Y$ for $P$
A general rule is:$$\mathbb EZ=\mathbb E[\mathbb E[Z\mid Y]]$$Applying this rule on $Z=\mathbf1_{X=5}$ we find:
$$P(X=5)=\mathbb E\mathbf1_{X=5}=\mathbb E[\mathbb E[\mathbf1_{X=5}\mid Y]]=\mathbb E[P(X=5\mid Y)]=\mathbb EY^5=\int_0^1y^5dy=\frac16$$