Why is $\sum\limits_{k=0}^{n}(-1)^k\binom{n}{k}^2=(-1)^{n/2}\binom{n}{n/2}$ if $n$ is even? [duplicate]
$$\sum_k (-1)^k{n\choose k}^2= \sum_k (-1)^k{n\choose k}{n\choose n-k}$$ is the coefficient of $x^n$ in $$(1-x)^n(1+x)^n=\sum_k{(-1)^k{n\choose k}}x^k\cdot \sum_k{{n\choose k}}x^k.$$ As $(1-x)^n(1+x)^n=(1-x^2)^n$, the claim follows (and we additionally see that $\sum_k (-1)^k{n\choose k}^2=0$ if $n$ is odd).
$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ $\ds{\sum_{k = 0}^{n}\pars{-1}^{k}{n \choose k}^{2} =\pars{-1}^{n/2}{n \choose n/2}}$
$$ \mbox{Hereafter we'll use widely the identity}\quad {s \choose \ell} = \oint_{\verts{z}\ =\ 1}{\pars{1 + z}^{s} \over z^{\ell + 1}} \,{\dd z \over 2\pi\ic}\tag{1} $$
\begin{align}&\color{#c00000}{\sum_{k = 0}^{n}\pars{-1}^{k}{n \choose k}^{2}} =\sum_{k = 0}^{n}\pars{-1}^{k}{n \choose k}\ \overbrace{\oint_{\verts{z}\ =\ 1} {\pars{1 + z}^{n} \over z^{k + 1}}\,{\dd z \over 2\pi\ic}} ^{\ds{\mbox{See identity}\ \pars{1}}} \\[3mm]&=\oint_{\verts{z}\ =\ 1}{\pars{1 + z}^{n} \over z} \sum_{k = 0}^{n}{n \choose k}\pars{-\,{1 \over z}}^{k}\,{\dd z \over 2\pi\ic} =\oint_{\verts{z}\ =\ 1}{\pars{1 + z}^{n} \over z} \bracks{1 + \pars{-\,{1 \over z}}}^{n}{\dd z \over 2\pi\ic} \\[3mm]&=\pars{-1}^{n}\oint_{\verts{z}\ =\ 1}{\pars{1 - z^{2}}^{n} \over z^{n + 1}} {\dd z \over 2\pi\ic} =\pars{-1}^{n}\oint_{\verts{z}\ =\ 1}{1 \over z^{n + 1}}\ \overbrace{\sum_{k = 0}^{n}{n \choose k}\pars{-1}^{k}z^{2k}} ^{\ds{=\ \pars{1 - z^{2}}^{n}}}\ {\dd z \over 2\pi\ic} \\[3mm]&=\pars{-1}^{n}\sum_{k = 0}^{n}{n \choose k}\pars{-1}^{k} \oint_{\verts{z}\ =\ 1}{1 \over z^{\color{#00f}{\Large n\ -\ 2k}\ +\ 1}} \,{\dd z \over 2\pi\ic} \qquad\qquad\qquad\qquad\qquad\qquad\qquad\pars{2} \end{align}
$$ \mbox{However,}\quad \oint_{\verts{z}\ =\ 1}{1 \over z^{\color{#00f}{\Large n\ -\ 2k}\ +\ 1}} \,{\dd z \over 2\pi\ic} =\left\lbrace\begin{array}{lcl} 1 & \mbox{if} & n\ \mbox{is even and}\ n = 2k \\ 0 && \mbox{otherwise} \end{array}\right.\qquad\qquad\,\quad\pars{3} $$
With $\pars{2}$ and $\pars{3}$, we'll find: $$\color{#00f}{\large% \sum_{k = 0}^{n}\pars{-1}^{k}{n \choose k}^{2}} =\color{#00f}{\large\left\lbrace\begin{array}{lcl} \pars{-1}^{n/2}{n \choose n/2} & \mbox{if} & n\ \mbox{is even} \\ 0 && \mbox{otherwise} \end{array}\right.} $$
If $n=2m$ the problem becomes $\displaystyle\sum\limits_{k=0}^{2m}(-1)^k\binom{2m}{k}^2=(-1)^m\binom{2m}m$
Now for non-zero finite $x,$
$\displaystyle(1+x)^n\left(1-\frac1x\right)^n=\frac{(1-x^2)^n}{x^n}(-1)^n$
Now compare the constant terms of the above identity.
Here $n=2m$