How do we prove the following binomial identity?

Well, if $n$ is odd, say $n=2k+1,$ then the right-hand side can be rewritten as $$(2k+1)(1-p)\left(\bigl((1-p)+p\bigr)^{2k}-\bigl((1-p)+(-p)\bigr)^{2k}\right).$$ Try applying the Binomial Theorem to $\bigl((1-p)+p\bigr)^{2k}$ and $\bigl((1-p)-p\bigr)^{2k}$ and see what you can do from there.

Similarly, if $n=2k,$ then the right-hand side can be rewritten as $$2k(1-p)\left(\bigl((1-p)+p\bigr)^{2k-1}+\bigl((1-p)-p\bigr)^{2k-1}-2(1-p)^{2k-1}\right).$$ Once again, we can start by applying Binomial Theorem to the respective powers of $(1-p)+p$ and $(1-p)-p.$