Let $x_1,\cdots, x_n$ be different real numbers. Prove that $$\sum_{1\leq i\leq n} \prod_{j\neq i} \frac{1-x_ix_j}{x_i-x_j} = \begin{cases} 0,&\text{if }n\text{ is even}\\ 1,&\text{if }n\text{ is odd}\end{cases}.$$
Let $f(t) = \prod_{i=1}^n (1-x_i t)$. Note that $f(x_i) = (1-x_i^2)\prod_{j\neq i} (1-x_ix_j)$.
First, I think one can ignore the case where $\{x_1,\dots, x_n\}\cap \{-1,1\}\neq \emptyset$, but I'm not sure how to justify this, which is the point of this question.
I think I should use a similar approach to below. For instance, if one assumes that $x_i = 1$ and $x_j=-1$ for some $i,j$, Lagrange interpolation gives the following expression: $\sum_{1\leq k\leq n, k\neq i,j} f(x_k) \dfrac{(x-1)(x+1)}{(x_k - 1)(x_k + 1)} \prod_{a\neq j,i,k} \dfrac{x-x_a}{x_k - x_a} + f(1) \dfrac{x+1}{1+1}\prod_{1\leq k\leq n, k\neq j,i} \dfrac{x-x_k}{1-x_k} + f(-1)\dfrac{x-1}{-1-1}\prod_{1\leq k\leq n,k\neq i,j}\dfrac{x-x_k}{-1-x_k}$.
The issue is that we need one more interpolation point to uniquely determine $f$ in this case; the above expression clearly does not have to equal $f$.
Now assuming that we can ignore the above case, one can use Lagrange interpolation to get the following expression for $f$: $\sum_{i=1}^n f(x_i) \dfrac{(x-1)(x+1)}{(x_i - 1)(x_i + 1)} \prod_{j\neq i} \dfrac{x-x_j}{x_i - x_j} + f(1) \dfrac{x+1}{1+1}\prod_{1\leq i\leq n} \dfrac{x-x_i}{1-x_i} + f(-1)\dfrac{x-1}{-1-1}\prod_{1\leq i\leq n}\dfrac{x-x_i}{-1-x_i}$. Setting the coefficient of $x^{n+1}$ on both sides equal to zero, we eventually get that if $H(x_1,\cdots, x_n)$ denotes the desired rational function, then $H(x_1,\cdots, x_n) = \dfrac{1}2 (1 +(-1)^{n+1})$. Also there may be other methods involving multivariate polynomials.