Note that $\ell$ by itself does not interporate your points $f(x_i)$. It is just a stepping stone in developing a later expression for the actual interpolation.
$\ell(x)$ is just the monic (i.e., leading coefficient = 1) polynomial having simple zeros at each of the interpolation points $x_i$ and no other zeros.
For fixed $j$, by removing the $(x - x_j)$ factor from $\ell$, we get another polynomial with simple zeros at all the other interpolation points, but which is non-zero for $x_j$. Call it $$L_j(x) = (x - x_0)...(x- x_{j-1})(x-x_{j+1})...(x-x_n) = \frac {\ell(x)}{x - x_j}$$
But this isn't quite useful enough. We'd like to have $\ell_j(x_j) = 1$ as well. But that is simply a matter of dividing by the right constant:
$$\ell_j(x) = \frac {L_j(x)}{L_j(x_j)}$$
You may note that $x = x_j$ is the one point where the equation $$L_j(x) = \frac {\ell(x)}{x - x_j}$$ does not hold, since the right-hand side is undefined there. However, $L_j(x_j)$ itself is defined. It is just $$L_j(x_j) = (x_j - x_0)...(x_j- x_{j-1})(x_j-x_{j+1})...(x_j-x_n)$$
To make the notation a little easier, we rename $$w_j = \frac 1{L_j(x_j)}$$, giving the expression in your post. I'll leave proving that $L_j(x_j) = \ell'(x_j)$ to you.
The point of all of this is that now we have a set of polynomials with the property that $$\ell_j(x_i) = \begin{cases} 1 & i = j\\0 & i \ne j\end{cases}$$ and are the simplest such polynomials possible. And therefore we can take $$P(x) = \sum_{i=0}^n f(x_i)\ell_i(x)$$
This is a different approach than the ones in Proof of relation between divided difference and interpolation polynomial coefficient. Possibly unnecessarily complex, but it gets the job done. We will see that the divided difference is the leading coefficient of the Lagrange polynomial, which will let us prove that the two types of polynomials are equal by induction.
Let $\ell[x_0, x_1, \cdots, x_n]$ be the leading coefficient of the Lagrange polynomial which passes through $f$ at $x_0, x_1, \cdots, x_n$. It is easily seen that
$$
\ell[x_0, x_1, \cdots, x_n] = \sum_{i=0}^n f(x_i) \prod_{\substack{j=0\\j\neq i}}^n \frac1{x_i - x_j}.
$$
We will show that $\ell[x_0, \cdots, x_n] = f[x_0, \cdots, x_n]$. Observe that
\begin{align}
& \ell[x_0, \cdots, x_n] - \ell[x_1, \cdots, x_{n+1}]\\
=\,& \sum_{i=0}^n f(x_i) \prod_{\substack{j=0\\j\neq i}}^n \frac1{x_i - x_j} - \sum_{i=1}^{n+1} f(x_i) \prod_{\substack{j=1\\j\neq i}}^{n+1} \frac1{x_i - x_j} \\
=\,& f(x_0)\prod_{\substack{j=1}}^n \frac1{x_0 - x_j} +
\sum_{i=1}^n f(x_i)
\left(\prod_{\substack{j=0\\j\neq i}}^n \frac1{x_i - x_j} - \prod_{\substack{j=1\\j\neq i}}^{n+1} \frac1{x_i - x_j}\right)
- f(x_{n+1})\prod_{\substack{j=1}}^n \frac1{x_{n+1} - x_j}\\
=\,& f(x_0)\prod_{\substack{j=1}}^n \frac1{x_0 - x_j} +
\sum_{i=1}^n f(x_i)
\left(\frac1{x_i - x_0} - \frac1{x_i - x_{n+1}}\right)\prod_{\substack{j=1\\j\neq i}}^n \frac1{x_i - x_j}
- f(x_{n+1})\prod_{\substack{j=1}}^n \frac1{x_{n+1} - x_j}\\
=\,& f(x_0)\prod_{\substack{j=1}}^n \frac1{x_0 - x_j} +
\sum_{i=1}^n f(x_i)
\frac{x_0 - x_{n+1}}{(x_i - x_0)(x_i - x_{n+1})}\prod_{\substack{j=1\\j\neq i}}^n \frac1{x_i - x_j}
- f(x_{n+1})\prod_{\substack{j=1}}^n \frac1{x_{n+1} - x_j} \\
=\,& f(x_0)\prod_{\substack{j=1}}^n \frac1{x_0 - x_j} +
(x_0 - x_{n+1})\sum_{i=1}^n f(x_i)\prod_{\substack{j=0\\j\neq i}}^{n+1} \frac1{x_i - x_j}
- f(x_{n+1})\prod_{\substack{j=1}}^n \frac1{x_{n+1} - x_j} \\
=\,& (x_0 - x_{n+1}) \left( f(x_0)\prod_{\substack{j=1}}^{n+1} \frac1{x_0 - x_j} +
\sum_{i=1}^n f(x_i)\prod_{\substack{j=0\\j\neq i}}^{n+1} \frac1{x_i - x_j}
+ f(x_{n+1})\prod_{\substack{j=0}}^n \frac1{x_{n+1} - x_j} \right) \\
=\,& (x_0 - x_{n+1}) \sum_{i=0}^{n+1} f(x_i)\prod_{\substack{j=0\\j\neq i}}^{n+1} \frac1{x_i - x_j} \\
=\,&(x_0 - x_{n+1}) \ell[x_0, \cdots, x_{n+1}].
\end{align}
Excuse the mess. The idea isn't too complex, it just takes a ton of space to write out in LaTeX. We just showed that $\ell$ satisfies the divided difference recursive formula
$$
\ell[x_0, \cdots, x_{n+1}] = \frac{\ell[x_0, \cdots, x_n] - \ell[x_1, \cdots, x_{n+1}]}{x_0 - x_{n+1}}.
$$
And since $\ell[x] = f[x] = f(x)$, it must be that $\ell[x_0, \cdots, x_n] = f[x_0, \cdots, x_n]$.
Now we can prove by induction that $q_n$ = $p_n$ for all $n$. For the base case, you can easily verify that $q_0 = p_0$. Now assume that $q_n = p_n$, and consider
$$
r(x) = q_n(x) + c \cdot (x - x_0)(x - x_1)\ldots(x - x_n),
$$
where $c$ is chosen so that $r(x_{n+1}) = f(x_{n+1})$. (Note that there is one and only one such value of $c$.) Clearly, $r$ is the unique $n+1$ degree polynomial which meets $f$ at $x_0, x_1, \cdots, x_{n+1}$. Thus $r = p_{n+1}$. But since $c$ is the leading coefficient of $r = p_{n+1}$, we have $c = \ell[x_0, \cdots x_{n+1}] = f[x_0, \cdots x_{n+1}]$. Thus
$$
p_{n+1}(x) = r(x) = q_n(x) + f[x_0, \cdots x_{n+1}] \cdot (x - x_0)(x - x_1)\ldots(x - x_n) = q_{n+1}(x).
$$
This completes the induction.
Best Answer
I think it is easier if you use the product notation:
$$L_k (x) = \frac{\prod_{i=0, i\neq k}^n (x-x_i)} {\prod_{i=0, i\neq k}^n (x_k-x_i)} = \prod_{i=0, i\neq k}^n \frac{(x-x_i)} {(x_k-x_i)}$$
The bottom is a product of numerical values, hence again a number. Instead the top is a product of $n$ linear terms hence a polynomial of degree $n$. Nothing to prove just a matter of fact. The fact $i\neq k$ avoid singularity of the form $\frac{1}{0}$.
$L_k$ acts as a "switch" when evaluated on the original points just because of their definition
$L_k(x_k) = \frac{\prod_{i=0, i\neq k}^n (x_k-x_i)} {\prod_{i=0, i\neq k}^n (x_k-x_i)} = \prod_{i=0, i\neq k}^n \frac{(x_k-x_i)} {(x_k-x_i)} = 1$
$L_k(x_j) = \frac{\prod_{i=0, i\neq k}^n (x_j-x_i)} {\prod_{i=0, i\neq k}^n (x_k-x_i)} = (x_j - x_j) \frac{\prod_{i=0, i\neq k \neq j}^n (x_j-x_i)}{\prod_{i=0, i\neq k}^n (x_k-x_i)} = 0$
This proves $(1)$.
$f(x) = \sum_{i=0}^n f_i L_i(x)$ will be just the form of the polynomial passing through all the given points ${(x_i, f_i)}_{i=0}^n$. The $L_i$ form a basis of the basis of polynomials.