For each $i\in\{1,\ldots,n\}$ you evaluate $b_i^2\prod_{j=1}^ia_j$, and you then compute the sum of these $n$ products. E.g., if $n=3$ you have
$$b_1^2a_1+b_2^2a_1a_2+b_3^2a_1a_2a_3\,.$$
You cannot reverse the order of the sum and product without changing the limits, because the expression
$$\prod_{j=1}^ia_j\sum_{i=1}^nb_i^2$$
makes no sense: the $i$ that is the upper limit of the product must be a constant, while the index $i$ in the summation is a variable that ranges from $1$ through $n$. You can, however, have
$$\prod_{i=1}^na_i\sum_{j=1}^ib_j^2\,;$$
with $n=3$ this is
$$a_1b_2^2+a_2(b_1^2+b_2^2)+a_3(b_1^2+b_2^2+b_3^2)\,.$$
I would normally add parentheses:
$$\sum_{i=1}^n\left(a_i\prod_{j=1}^ib_j^2\right)$$
and
$$\prod_{i=1}^n\left(a_i\sum_{j=1}^ib_j^2\right)$$
in both cases. They make the expressions easier to read, but they are not absolutely necessary, since their existence can be inferred from the fact that the upper limit of the inner expression depends on the index in the outer expression.