Let $a$ and $\phi$ be independent random variables, each with a known probability density function. Furthermore, in the sequences of observations $(a_{1},a_{2},...,a_{N})$ all $a_{i}$ are independent and identically distributed ($iid$). Similarly, in the sequence of observations $(\phi_{1},\phi_{2},...,\phi_{N})$ all $\phi_{i}$ are independent and identically distributed.
The goal is to calculate $E[P]$ where $P$ is given by:
$$P=\sum_{i=1}^{N}\sum_{j=1}^{N}a_{i}a_{j}\cos\left(\phi_{i}-\phi_{j}\right)$$
Here's what I came up with so far:
$$P = \sum_{i=1}^{N}a_{i}^{2} + \sum_{i=1}^{N}\sum_{j=1,j\neq i}^{N}a_{i}a_{j}\cos\left(\phi_{i}-\phi_{j}\right)$$
$$E[P]=\sum_{i=1}^{N} E[a_{i}^{2}] + \sum_{i=1}^{N}\sum_{j=1,j\neq i}^{N}E[a_{i}a_{j}\times \cos(\phi_{i}-\phi_{j})]$$
because $a$ and $\phi$ are independent RVs we can write:
$$E[P] = \sum_{i=1}^{N} E[a_{i}^{2}] + \sum_{i=1}^{N}\sum_{j=1,j\neq i}^{N}E[a_{i}a_{j}] E[\cos(\phi_{i}-\phi_{j})]$$
because the $a$ sequence is $iid$ we can write:
$$E[P] = \sum_{i=1}^{N} E[a_{i}^{2}] + \sum_{i=1}^{N}\sum_{j=1,j\neq i}^{N}E[a_{i}]E[a_{j}] E[\cos(\phi_{i}-\phi_{j})]$$
and finally: $$E[P] = N E[a^{2}] + N(N-1) E[a]^{2} E[\cos(\Delta\phi)]$$
where, since the $\phi$ sequence is $iid$, we have $E[\cos(\Delta\phi)] = \int\int p_{\phi}^{2}(\phi)\cos(\phi_{i}-\phi_{j})d\phi_{i}d\phi_{j}$.
Does this make sense?