I'm trying to figure out how to compute the expectation of $\sum_{i=1}^N\sum_{j=1,i\neq j}^{N} X_iX_j$ where $N$ is a random variable and the $X$'s are all IID. The RV $N$ can theoretically be any positive integer. What inspired this problem was a random walk problem where $N$ is the number of steps to a certain end state. The probability of reaching the end state is 1, so perhaps $N$ cannot go all the way to infinity.
Here's my attempt:
\begin{align} E \left [\sum_{i=1}^N\sum_{j=1,i\neq j}^{N} X_iX_j \right] = \sum_{n=1} ^{\infty} E\left [\sum_{i=1}^{N}\sum_{j=1, j\neq i}^{N} X_iX_j \bigg| N=n \right]P(N=n) && \text{law of total expectation}\\ = \sum_{n=1} ^{\infty} E\left [\sum_{i=1}^{n}\sum_{j=1, j\neq i}^{n} X_iX_j\right]P(N=n) && \text{assign $n$ to $N$ and get rid of the conditional}\\ = \sum_{n=1} ^{\infty} \sum_{i=1}^{n}\sum_{j=1, j\neq i}^{n} E[X_iX_j]P(N=n) && \text{by linearity of expectation} \\ = \sum_{n=1} ^{\infty} \sum_{i=1}^{n}\sum_{j=1, j\neq i}^{n} E[X_i]E[X_j]P(N=n) && \text{by independence of $X$'s} \\ = \sum_{n=1} ^{\infty} n(n-1) E[X_i]E[X_j]P(N=n) && \text{$X$'s are identically distributed so it reduces to this}\\ \\ \end{align}
At this point, I am unsure what this expression means. Unless $E[X_i]$ and/or $E[X_j]$ is zero, in which case the above expression is ZERO, does the above expression become unbounded? My intuition tells me that $\lim_{n \rightarrow \infty} \implies P(n) \rightarrow 0$, but it's not clear to me how this affects the above expression.
This question was inspired by David's answer in Simple Question: Stopped Martingale Expected Value, under his "Method 2" (I think there are some errors in there, but that's not the point of my post). In this linked question, $E[X] = 0$, but for my question, I want to know what happens if $E[X] \neq 0$.