Estimate the integral of the absolute value of the Dirichlet kernel

$D_n=\sum_{k=-n}^n e^{k i x}=\sin ((N+1/2)x)/\sin(x/2)$

Prove that $$L_n=\frac{1}{2\pi}\int_{-\pi}^{\pi}|D_n|dx=\frac{4}{\pi^2}\log n+O(1)$$

A problem in "Fourier Analysis" by E. Stein and R. Shakarchi explains how to show $L_n\ge C \log n$. Afterwards, it says more careful estimate shows this equality.

I already have $$\int_{k\pi}^{(k+1)\pi}|\frac{\sin t}{t}|dt=\frac{2}{\pi}\frac{1}{k}+O(\frac{1}{k^2})$$ $$\sum_{k=1}^{n}\frac{1}{k}=\log n+\gamma+O(\frac{1}{n})$$ so that $$\int_{\pi}^{(k+1)\pi}|\frac{\sin t}{t}|dt=\frac{2}{\pi}\log n+O(1)$$

If we can have $$L_n=\frac{2}{\pi}\int_{\pi}^{(n+1)\pi}|\frac{\sin t}{t}|dt+O(1)$$, then we are done. According are two steps

  1. $$2 \pi L_n=\int_{-\pi}^{\pi}|\frac{\sin ((N+1/2)x)}{t/2}|dt+O(1)$$
  2. $$\int_{-\pi}^{\pi}|\frac{\sin ((N+1/2)x)}{t/2}|dt=4\int_{\pi}^{N\pi}|\frac{\sin t}{t}|dt+O(1)$$ Now I think I need some help on these two steps.

\begin{align*} &L_{n}=\dfrac{1}{\pi}\int_{0}^{\pi}\left|\dfrac{\sin{(n+\frac{1}{2})x}}{\sin{\frac{x}{2}}}\right|dx>\dfrac{2}{\pi}\int_{0}^{\frac{\pi}{2}}\left|\dfrac{\sin{(n+\frac{1}{2})2t}}{\sin{t}}\right|dt>\dfrac{2}{\pi}\int_{0}^{\frac{\pi}{2}}\dfrac{|\sin{(n+\frac{1}{2})2t}|}{t}dt\\ &=\dfrac{2}{\pi}\int_{0}^{(2n+1)\pi/2}\dfrac{|\sin{u}|}{u}du>\dfrac{2}{\pi}\sum_{k=0}^{n-1}\int_{k\pi}^{(k+1)\pi}\dfrac{|\sin{u}|}{u}du\\ &=\dfrac{2}{\pi}\sum_{k=0}^{n-1}\int_{0}^{\pi}\dfrac{\sin{u}}{u+k\pi}du>\dfrac{2}{\pi}\sum_{k=0}^{n-1}\dfrac{1}{(k+1)\pi}\int_{0}^{\pi}\sin{u}du\\ &=\dfrac{4}{\pi^2}\sum_{k=0}^{n-1}\dfrac{1}{k+1} >\dfrac{4}{\pi^2}\ln{n}+\dfrac{4}{\pi^2}\gamma \end{align*} where $\gamma$ is Euler's constant. other hand

$$\left|\dfrac{\sin(n+1/2)t}{\sin{t/2}}-\dfrac{\sin{nt}}{\tan{t/2}}\right|\le 1$$

so \begin{align*} &L_{n}\le 1+\dfrac{2}{\pi}\int_{0}^{\pi/2}\left|\dfrac{\sin{(2nt)}}{\tan{t}}\right|dt\\ &<1+\dfrac{2}{\pi}\int_{0}^{\pi/2}\dfrac{|\sin{2nt}|}{t}dt\\ &=1+\dfrac{2}{\pi}\sum_{k=1}^{n}\int_{0}^{\pi}\dfrac{\sin{t}}{t+(k-1)\pi}dt\\ &<1+\dfrac{2}{\pi}\int_{0}^{\pi}\dfrac{\sin{t}}{t}dt+\dfrac{4}{\pi^2}\sum_{k=2}^{n}\dfrac{1}{k-1}\\ &<C+\dfrac{4}{\pi^2}\ln{n}+\dfrac{4}{\pi^2}\gamma \end{align*} so your result is obvious.