Binomial theorem and sum from $k = 0$ to $N/2$ While calculating a partition function in physics, I stumbled across a weird sum, namely:
$$Z=\sum_{k=0}^{N/2}{N \choose 2k}b^{N-k}e^{ak}$$
Wolfram says that it's equal to:
$$Z = \frac{1}{2}\left((b-\sqrt{b}e^{a/2})^N+(b+\sqrt{b}e^{a/2})^N\right)=\frac{(x-y)^N+(x+y)^N}{2}$$
But I dont understand how we can link it to the binomial theorem since the coefficient is: ${N \choose 2k}$ and not ${N/2 \choose 2k}$ and then prove the formula.

It might be easier to see what is going on if we write out some terms:
$$
\begin{align}
&\overbrace{\sum_{k=0}^N\binom{N}{k}b^{N-k/2}e^{ak/2}}^{b^{N/2}\left(\sqrt{b}+e^{a/2}\right)^N}+\overbrace{\sum_{k=0}^N(-1)^k\binom{N}{k}b^{N-k/2}e^{ak/2}}^{b^{N/2}\left(\sqrt{b}-e^{a/2}\right)^N}\tag1\\[6pt]
&=\phantom{2}\binom{N}{0}b^Ne^0+\binom{N}{1}b^{N-1/2}e^{a/2}+\phantom{2}\binom{N}{2}b^{N-1}e^a+\binom{N}{3}b^{N-3/2}e^{3a/2}+\cdots\tag{2a}\\
&+\phantom{2}\binom{N}{0}b^Ne^0-\binom{N}{1}b^{N-1/2}e^{a/2}+\phantom{2}\binom{N}{2}b^{N-1}e^a-\binom{N}{3}b^{N-3/2}e^{3a/2}+\cdots\tag{2b}\\[6pt]
&=2\binom{N}{0}b^Ne^0\phantom{{}+\binom{N}{1}b^{N-1/2}e^{a/2}}+2\binom{N}{2}b^{N-1}e^a\phantom{{}+\binom{N}{3}b^{N-3/2}e^{3a/2}}+\cdots\tag3\\[6pt]
&=2\sum_{j=0}^{\lfloor N/2\rfloor}\binom{N}{2j}b^{N-j}e^{aj}\tag4
\end{align}
$$
The terms with even $k$ in $(1)$ become the terms with $2j$ in $(4)$ and the term with odd $k$ in $(1)$ cancel each other. Since $k$ goes from $0$ to $N$, $j$ goes from $0$ to $\lfloor N/2\rfloor$.
We can substitute $j\mapsto k$ in $(4)$, if desired.
