Conditional expectation of product of sums of bernoulli random variables let's say we have $X_1,..,X_n$ i.i.d. Bernoulli random variables. For $l<m<n$, we want to calculate:
$$ E \left[ \sum_{i=1}^{l}X_i \sum_{j=1}^{m}X_j \mid \sum_{k=1}^{n}X_k \right] $$
Does this property apply in this situation?
$$E \left[ X Y \mid Z \right] =  E \left[X\mid Z \right] E\left[Y\mid Z \right]$$
 A: If $X_1,\ldots,X_n$ are i.i.d $\mathsf{Bernoulli}(p)$ and $S_n=\sum\limits_{i=1}^n X_i$, the conditional expectation $E\left[S_lS_m\mid S_n\right]$ is just the unbiased estimator of $E\left[S_lS_m\right]$ based on $S_n$ by Lehmann-Scheffé theorem. In other words, it is the UMVUE of $E\left[S_lS_m\right]$.
Keeping in mind that $l<m$,
\begin{align}
E\left[S_lS_m\right]&=E\left[\sum_{i=1}^l\sum_{j=1}^m X_iX_j\right]
\\&=\mathop{\sum_{i=1}^l\sum_{j=1}^m}_{i\ne j} E\left[X_iX_j\right]+\sum_{i=1}^l E\left[X_i^2\right]
\\&=l(m-1)E[X_i]E[X_j]+\sum_{i=1}^l \left(\operatorname{Var}(X_i)+(E[X_i])^2\right)
\\&=l(m-1)p^2+l(p(1-p)+p^2)=\cdots
\end{align}
Using $S_n\sim \mathsf{Bin}(n,p)$, we already have
$$E\left[\frac{S_n}{n}\right]=p$$
and $$E\left[\frac{S_n(S_n-1)}{n(n-1)}\right]=p^2$$
A: No it wouldnt apply. The statement E[XY]=E[X]E[Y] is only valid when X and Y are independent, which is not the case in your setting since the summations run over the same X_i variable, making the sums dependent.
The answer here may be useful: https://math.stackexchange.com/questions/1476906/expectation-of-the-product-of-two-dependent-binomial-random-variable
