How can I evaluate the following sum: $\sum_{k=0}^{n-1}\binom{2n-1}{k}\left[\text{sgn}(2n-2k-2)+\text{sgn}(2n-2k)\right]$?? I was trying to prove the equality below:
$$
\int_0^\infty\frac{1-\cos^{2n}(x)}{x^2}\mathrm dx=\frac{n\pi}{4^n}\binom{2n}{n}.
$$
First, I proceeded using IBP making $u=1-\cos^{2n}(x)$ and $\mathrm dv=\frac{1}{x ^ 2}$, so i got:
$$\int_0^\infty\frac{1-\cos^{2n}(x)}{x^2}\mathrm dx=2n\int_0^\infty\frac{\cos^{2n-1}(x)\sin(x)}{x}\mathrm dx. $$
Here, I used the identity for the term $\cos^{2n-1}(x)$:
$$\cos^{2n-1}(x)=\frac{2}{2^{2n-1}}\sum_{k=0}^{n-1}\binom{2n-1}{k}\cos\left[(2n-k-1)x\right]$$
And, in short, using the property $2\cos(\theta)\sin(\varphi)=\sin(\theta+\varphi)+\sin(\theta-\varphi)$ and Dirichlet Integral, i arrived at:
$$\int_0^\infty\frac{1-\cos^{2n}(x)}{x^2}\mathrm dx=\frac{2n\pi}{4^n}\sum_{k=0}^{n-1}\binom{2n-1}{k}\left[\text{sgn}(2n-2k-2)+\text{sgn}(2n-2k)\right]$$
Here is my difficulty, I know the definitions of the Sign Function $\text{sgn}(z)$, but I do not know how to approach using the cases of the definition of this function. By hypothesis, we would have:
$$\sum_{k=0}^{n-1}\binom{2n-1}{k}\left[\text{sgn}(2n-2k-2)+\text{sgn}(2n-2k)\right]=\frac{1}{2}\binom{2n}{n}$$
 A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[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{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
$\ds{\bbox[5px,#ffd]{\sum_{k = 0}^{n - 1}{2n - 1 \choose k}
\bracks{\on{sgn}\pars{2n - 2k - 2} + \on{sgn}\pars{2n - 2k}}}:
\ {\Large ?}}$.

\begin{align}
&\bbox[5px,#ffd]{\sum_{k = 0}^{n - 1}{2n - 1 \choose k}
\bracks{\on{sgn}\pars{2n - 2k - 2} + \on{sgn}\pars{2n - 2k}}}
\label{1}\tag{1}
\\[5mm] = &\
-\sum_{k = 0}^{n - 1}{2n - 1 \choose k}
\bracks{\on{sgn}\pars{k - \bracks{n - 1}} + \on{sgn}\pars{k - n}}
\\[5mm] = &\
2\sum_{k = 0}^{n - 2}{2n - 1 \choose k} + {2n - 1 \choose n - 1} =
-{2n - 1 \choose n - 1} + 2\
\underbrace{\sum_{k = 0}^{n - 1}{2n - 1 \choose k}}
_{\ds{\equiv {\tt J}}}\label{2}\tag{2}
\\[5mm] = &\
-{2n - 1 \choose n - 1} +
2\sum_{k = 0}^{2n - 1}{2n - 1 \choose k} -
2\sum_{k = n}^{2n - 1}{2n - 1 \choose k}
\\[5mm] = &\
-{2n - 1 \choose n - 1} +
2\pars{2^{2n - 1}} -
2\sum_{k = 0}^{n - 1}{2n - 1 \choose k + n}
\\[5mm] = &\
-{2n - 1 \choose n - 1} + 2^{2n} -
2\sum_{k = 0}^{n - 1}{2n - 1 \choose
\bracks{n - 1 - k} + n}
\\[5mm] = &\
-{2n - 1 \choose n - 1} + 2^{2n} -
2\
\underbrace{\sum_{k = 0}^{n - 1}{2n - 1 \choose k}}
_{\ds{=\ {\tt J}}}
\label{3}\tag{3}
\end{align}
With (\ref{2}) and (\ref{3}):
\begin{equation}
{\tt J} \equiv \sum_{k = 0}^{n - 1}{2n - 1 \choose k} =
2^{2n - 2}
\label{4}\tag{4}
\end{equation}
With (\ref{1}), (\ref{2}) and (\ref{4}):
\begin{align}
&\bbox[5px,#ffd]{\sum_{k = 0}^{n - 1}{2n - 1 \choose k}
\bracks{\on{sgn}\pars{2n - 2k - 2} + \on{sgn}\pars{2n - 2k}}}
\\[5mm] = &\
\bbx{2^{2n - 1} - {2n - 1 \choose n - 1}} \\ &
\end{align}
