Let $\mathscr{I}$ be a finite set and $(Y_i)_{i \in \mathscr{I}}$ be a family of random variables that are pairwise independent, take real values and whose squares have finite expectation. Show that
$$\mathbb{E}\left(\left(\sum_{i \in \mathscr{I}} Y_i\right)^2\right) = \left(\sum_{i \in \mathscr{I}} \mathbb{E}(Y_i)\right)^2 + \sum_{i \in \mathscr{I}} \operatorname{Var}(Y_i).$$