I am reading how Simpson's Rule works for numerical integration. So I understand that given the two endpoints $x_0$ and $x_2$, and one intermediate point $x_1$, we can connect these points to make a parabolic function as an approximation to the original function which we want to integrate.
The book then proceeds to give the following formula, which I do not understand.
Where did the coefficients of $f(x_0), f(x_1), f(x_2)$ come from?

The interpolating polynomial can be written as \begin{align*} p_2(x)= &\sum_{i=0}^2 L_i(x) f(x_i)=\sum_{i=0}^2 \frac{\prod_{j \ne i}(x-x_j)}{\prod_{j \ne i}(x_i-x_j)} f(x_i)\\ =& \frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}f(x_0)+\frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}f(x_1)+\frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}f(x_2) \end{align*}
Simpson's formula just uses, as you mention, the approximation $$ \int_{x_0}^{x_2} f(x)dx \approx \int_{x_0}^{x_2} p_2(x) dx. $$
Note: this works because $L_i(x_j) = \delta_{ij}$.