When does equality hold in $\Bigr\lvert\sum_{k=1}^n a_kb_k\Bigr\rvert^2 \le \left(\sum_{k=1}^n |a_k|^2\right)\left(\sum_{k=1}^n |b_k|^2\right)$?
If each of $a_1,...,a_n,b_1,..,b_n$ is zero, then the equality holds.
If some members of the set $\{b_1,..,b_n\}$ are zero, we can omit them.
Without loss of generality, we can assume that each of the $b_k$ is non zero for $k=1,2,...,n$. $\sum_{k=1}^{n}|a_k-\lambda \bar b_k|^2=0 \iff |a_k-\lambda b_k|^2=0$ for $k=1,2,...,n$ $\iff |a_k-\lambda \bar b_k|=0$ for $k=1,2,...,n$ $\iff a_k=\lambda \bar b_k$ for $k=1,2,...,n$.
Therefore, equality holds if and only if each of $a_k$ and $\bar b_k$ are proportional for $k=1,2,..,n$.