just multiply $(\sum z_j)(\sum \bar{z}_k)=\sum|z_l|^2+\sum_{j\neq k}z_j\bar{z}_k$ in terms of your $p$ and $\theta$ we have $ \sum 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 result you quoted
if you want
$|\sum z_l|^2=(\sum |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. plugging that into what we have above, we get
$ \sum p_l^2+\sum_{j\neq k} p_jp_ke^{i(\theta_j-\theta_k)}=\sum p_l^2+\sum_{j\neq k}p_jp_k=(\sum p_l)^2 $