Dirichlet integral integrates to $\pi$ I think the question has been asked several times on MSE since seems a standard fourier analysis fact, but I don't find any reference for it.
Let's consider the Dirichlet Kernel as $$D_n(x) := \sum\limits_{\lvert k \rvert \leq n}e^{ikx}$$
In a further proposition I think it's used something like $$\int_0^{\pi} D_n(x)dx = \pi$$
Is this true? I tried to computed this explicitly or using $$D_n(x) = \frac{\text{sin}\left(\left(n+\frac{1}{2}\right)x\right)}{\text{sin}(\frac{x}{2})} \hspace{0.2cm} \forall x\ne 0 \hspace{0.2cm} \text{mod} 2\pi$$
But I got stuck since the integral of the part relative to $\text{cos}$ is $0$, since integrate to $\text{sin}$, and the part relative to $\text{cos}$ depends on $k$ but the $i$ term remains.
Where is my mistake? And how to prove $$\int_0^{\pi} D_n(x)dx = \pi$$ if true
?

The truncated Fourier series $S_n(x)$ for a function $f$ on $[-\pi,\pi]$ is given by
\begin{align}
            S_N(f)(x)&=      \sum_{n=-N}^{N}\frac{1}{2\pi}\int_{-\pi}^{\pi}f(y)e^{-iny}dy e^{inx} \\
      &=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(y)\sum_{n=-N}^{N}e^{in(x-y)}dy \\
      &=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(y)D_N(x-y)dy
\end{align}
That defines the Dirichlet kernel $D_N (x)=\sum_{n=-N}^{N}e^{inx}$. Notice that $D_N(x)=D_N(-x)$ is an even function, and $\int_{-\pi}^{\pi}D_N(x)dx=2\pi$ because it gives you $2\pi$ times the truncated Fourier series of $1$, which is $2\pi$ for $N \ge 1$. So,
$$
 \int_0^\pi D_N(x)dx=\frac{1}{2}\int_{-\pi}^{\pi}D_N(x)dx=\frac{2\pi}{2}=\pi.
$$
