We estimate this by integration by parts, using the integral theorem for Dirichlet polynomials [1]},
\(\int _0^T \left|\sum _{1\le n\le N} a_nn^{it}\right|^2dt \ll \left( T+ \mathcal {O}(N)\right)\sum _{1\le n\le N} |a_n|^2.\) 
