Consider the series
$$S_n = a_1 + a_2(1-a_1) + a_3(1-a_2)(1-a_1)+\cdots+ a_n\prod_{i=1}^{n-1}(1-a_i)$$
$$0 For $a_i=a_j=a\;\; \forall i,j$ it is immediate to show that $S_n$ converges to $1$ as $n\to \infty$. I also simulated drawing the $a_i$'s as i.i.d. Uniform $U(0,1)$ random variables, and $S_n$ again converged to unity pretty convincingly. But I can't determine the needed conditions and prove theoretically convergence to unity, when the $a_i$'s vary (deterministically or as random variables). I notice that we can write $$S_n = a_1 + (1-a_1)\Big[a_2 +(1-a_2)\big[a_3+(1-a_3)[\cdots(1-a_{n-1}) a_n]\big]\Big]$$ All these seem eerily familiar but I can't pin down where I have seen these expressions before... QUESTION: What conditions are needed and how can we prove convergence to unity of the above infinite series?