$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove armada]{\displaystyle{#1}}\,}
\newcommand{\llaves}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\newcommand{\ic}{\mathrm{i}}
\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\mrm}[1]{\mathrm{#1}}
\newcommand{\pars}[1]{\left(\,{#1}\,\right)}
\newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\parcial #3^{#1}}}
\newcommand{\raíz}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
\newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
\newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[10px,#ffd]{\left.\int_{0}^{\pi}{\sin\pars{kx} \over \sin\pars{x}}\,\dd x\,\right\vert_{\ k\ =\ \pm 1,\ \pm 3,\
\pm 5,\ldots}} =
2\,\mrm{sgn}\pars{k}\Im\int_{0}^{\pi/2}{\expo{\ic\verts{k}x} - 1 \over \sin\pars{x}}\,\dd x
\\[5mm] = &\
\left.2\,\mrm{sgn}\pars{k}\Im\int_{x\ =\ 0}^{x\ =\ \pi/2}{z^\verts{k} - 1 \over \pars{1 - z^{2}}\ic/\pars{2z}}\,{\dd z \over \ic z}\,\right\vert_{\ z\ =\ \exp\pars{\ic x}}
\\[5mm] = &\
\left.4\,\mrm{sgn}\pars{k}\Im\int_{x\ =\ 0}^{x\ =\ \pi/2}
{1 - z^\verts{k} \over 1 - z^{2}}\,\dd z\,\right\vert_{\ z\ =\ \exp\pars{\ic x}}
\\[5mm] =&
-4\,\mrm{sgn}\pars{k}\Im\int_{1}^{0}
{1 - y^\verts{k}\expo{\ic\verts{k}\pi/2} \over 1 + y^{2}}\,\ic\,\dd y =
4\,\mrm{sgn}\pars{k}\int_{0}^{1}{\dd y \over 1 + y^{2}}
\\[5mm] = &
\bbx{\pi\,\mrm{sgn}\pars{k}\,\qquad k = \pm 1,\ \pm 3,\ \pm 5\ldots}
\end{align}
Tenga en cuenta que
$\ds{\left.\cos\pars{k\,{\pi \over 2}}
\,\right\vert_{\ k\ \mrm{impar}} = \color{red}{\large 0}}$.