Any hints to evaluate $\sum_{i=0}^{n}\frac{1+(-1)^i}{2}\binom{n}{i}$? [duplicate]

I am looking for any kind of help you can provide to evaluate the sum $\sum_{i=0}^{n}\frac{1+(-1)^i}{2}\binom{n}{i}$, which equals $\binom{n}{0} + \binom{n}{2} + \binom{n}{4} + \cdots + \binom{n}{k}$ where $k=n$ if $n$ is even or $k=n-1$ otherwise.

marked as duplicate by Math Lover, Lord Shark the Unknown, Nosrati, user99914, Community♦Dec 15 '17 at 5:33

As $x^2=1,x=?$
Set $b=\pm c$ in
$$(a+b)^n$$ and add
Can you recognize $a,c$ here?
Let's first note that: $2^n = (1+1)^n = \sum_{i=0}^n \binom{n}{i}1^{n-i}1^i = \sum_{i=0}^n \binom{n}{i}$ and that $0 = (1 + (-1))^n = \sum_{i=0}^n\binom{n}{i} 1^{n-i}(-1)^i = \sum_{i=0}^n \binom{n}{i}(-1)^i$. We have then:\begin{align*} \sum_{i=0}^{n}\frac{1+(-1)^i}{2}\binom{n}{i} &= \frac{1}{2}\sum_{i=0}^{n}\binom{n}{i}(1+(-1)^i) \\ &= \frac{1}{2}\left( \sum_{i=0}^{n}\binom{n}{i} + \sum_{i=0}^{n}\binom{n}{i}(-1)^i \right) \\ &= \frac{1}{2}\left( 2^n + 0 \right) \\ &= 2^{n-1} \text{.} \end{align*}