I have seen many books that state and prove the Cauchy-Schwarz inequality for two, positive-valued random variables $X$ and $Y$ with bounded expectation as \begin{equation} E[XY]^2\le E[X^2]E[Y^2]. \end{equation}
Can we extend this definition to $N>2$ random variables such that \begin{equation} E \left[ \sum_{n=1}^{N} X_n Y_n \right] ^2 \le E\left[ \sum_{n=1}^{N} X_n^2 \right] E\left[ \sum_{n=1}^{N} Y_n^2 \right], \end{equation} where all expectations are bounded? Could you suggest me a reference for this?
The Cauchy Schwarz inequality applied to the random vectors $x=(X_1,\dots X_N)$ and $y=(Y_1,\dots Y_N)$ gives the pointwise bound $$\left|\sum_{n=1}^N X_n Y_n\right|=|\langle x,y\rangle| \leq \|x\|\,\|y\|. \tag1$$ Combine (1) and your first inequality (with $X=\|x\|$ and $Y=\|y\|$) to obtain \begin{eqnarray*}\left|E\left(\sum_{n=1}^N X_n Y_n\right)\right| &\leq& E\left(\left|\sum_{n=1}^N X_n Y_n\right|\right)\\[5pt] &\leq& E(\|x\|\|y\|)\\[5pt] &\leq& E(\|x\|^2)^{1/2}\,E(\|y\|^2)^{1/2}\\[5pt] &=&E\left(\sum_{n=1}^N X_n^2\right)^{1/2}\,E\left(\sum_{n=1}^N Y_n^2\right)^{1/2}.\end{eqnarray*} Now square both sides of the inequality to get the desired result.