Multiply:
$$\left(\sum_j z_j\right)\left(\sum_k \bar{z}_k\right)=\sum_l|z_l|^2+\sum_{j\neq k}z_j\bar{z}_k.$$
In terms of your $p$ and $\theta$ we have
$$
\sum_l p_l^2+\sum_{j\neq k} p_jp_ke^{i(\theta_j-\theta_k)}.
$$
The cosine terms in $e^{i(\theta_j-\theta_k)}$ double up since cosine is even and the sine terms cancel since sine is odd, i.e.
$$
\cos(\theta_j-\theta_k)+\cos(\theta_k-\theta_j)=2\cos(\theta_j-\theta_k)
$$
and
$$
\sin(\theta_j-\theta_k)+\sin(\theta_k-\theta_j)=0.
$$
Hence you get the quoted result.
If you want
$|\sum_l z_l|^2=(\sum_l |z_l|)^2$ then all of the
$z_l$ must point in the same direction, in other words the
$\theta_l$ must all be the same (draw a picture). Plugging that into what we have above, we get
$$
\sum_l p_l^2+\sum_{j\neq k} p_jp_ke^{i(\theta_j-\theta_k)}=\sum_l p_l^2+\sum_{j\neq k}p_jp_k=\left(\sum_l p_l\right)^2.
$$