$w$ is an input word, $r$ is a random bits used by a machine to make random decisions.
So, it is obvious that $P \subseteq BPP$, so let's try to show that: $BPP \subseteq P$.
Let $L$ in $BPP$. Then $M(w, r)$ be a machine that decides $L \in BPP$. $M$ is a polynomial probabilistic machine. Let $M'(w, r)$ be an polynomially amplifcated $M$, so:
$$w \in L \implies Pr[M'(w, r) \text{ accepts }w] \to 1$$
$$w \not \in L \implies Pr[M'(w, r) \text{ rejects }w] \to 1$$
Now, we construct machine $M_p$ that recognizes $L$ and works in polynomial time.
Let $w$ be a given word to decide. $M_p$ constructs in polynomial time a boolan circuit $C$ equivalent to $M'(w,r)$ where $w$ be hardcoded in that circuit. So, the input word is a random string, $r$.
Note, that our machine $M_p$ So, for a random input $r$ our machine for word $w \in L$ must accept it if $M'$ accepts it with probability $\approx 1$.
But, we must show that $L \in P$ so we cannot use a random word $r$.
Instead, we would like to ask our algorithm about probability of acceptance a random word: $A(C)$. The returned value must be $\approx 0.6$ because possible error is $0.4$. So, if A(C) is $\ge 0.6$ then $M_p$ accepts, else rejects.
It works in polynomial and it accepts the same language:
$$w \in L \implies Pr[M' \text{ accepts w is }] \approx 1 $$
$$w \not \in L \implies Pr[M' \text{ rejects w is }] \approx 1 $$