Evaluate the sum $\sum\limits_{k=1}^n {\binom{n}{k} f(k)}$. 

Evaluate the following sum $:$
$$\sum\limits_{k=1}^n \binom{n}{k} f(k),$$ where $f(k)=0$ if $k$ is even and $f(k)=(-1)^{\frac {k-1} {2}}$ if $k$ is odd.


How do I proceed? Please help me in this regard.
Thank you very much.
 A: One method is to determine that $f(k) = \sin\left(\frac{k \, \pi}{2}\right)$. From this the following can be determined:
\begin{align}
\sum_{k=1}^{n} \binom{n}{k} f(k) &= \frac{1}{2 i} \, \left[\sum_{k=1}^{n} \binom{n}{k} \, e^{i k \pi/2} - \sum_{k=1}^{n} \binom{n}{k} \,  e^{-i k \pi/2} \right] \\
&= \frac{1}{2 i} \, \left[\sum_{k=0}^{n} \binom{n}{k} \, e^{i k \pi/2} - \sum_{k=0}^{n} \binom{n}{k} \,  e^{-i k \pi/2} \right] \\
&=  \frac{1}{2 i} \, \left[(1 + e^{i \pi/2})^{n} - (1 + e^{-i \pi/2})^{n} \right] \\
&= \frac{1}{2 i} \, \left[(1 + i)^{n} - (1 - i)^{n} \right] \\
&= 2^{n/2} \, \frac{1}{2 i} \, \left( e^{i n \pi/4} - e^{- i n \pi/4} \right) \\
&= 2^{n/2} \, \sin\left(\frac{n \pi}{4}\right).
\end{align}
This shows that:
$$ \sum_{k=1}^{n} \binom{n}{k} \, \sin\left(\frac{k \, \pi}{2}\right) = 2^{n/2} \, \sin\left(\frac{n \pi}{4}\right). $$
A: As already shown, complex numbers will come very handy. Here's one trick:
$$(1+i)^{n} = \binom{n}{0} + i\binom{n}{1} -\binom{n}{2} - i \binom{n}{3}... + i^{n} \binom{n}{n}$$
$$(1-i)^{n} = \binom{n}{0} - i\binom{n}{1} -\binom{n}{2} + i \binom{n}{3}... + (-i)^{n} \binom{n}{n}$$
It is easy to check now, (by multiplying both series by $i$ and subtracting the second from the first):
$$\frac{1}{2}i\left ((1-i)^{n} - (1+i)^{n}  \right ) = \binom{n}{1} - \binom{n}{3} +\binom{n}{5} - \binom{n}{7}... + ((-1)^n(i)^{n+1}-i^{n+1}) \binom{n}{n}$$
In terms of exponentials:
$$\frac{1}{2}i\left ((1-i)^{n} - (1+i)^{n}  \right )=\frac{1}{2}i2^{\frac{n}{2}}(e^{-\frac{i n \pi }{4}}-e^{\frac{i n \pi }{4}})= 2^{\frac{n}{2}}\frac{e^{\frac{i n \pi }{4}}-e^{-\frac{i n \pi }{4}}}{2i}=2^{\frac{n}{2}}sin\left ( \frac{n\pi }{4} \right )$$
As given in the other answer.
