<s>[INST] Faster than Euler's substitution. How to derive this formula? I wish someone could help me derive this expression. ($K$ is a constant coefficient. $P_n(x)$ is a polynomial function of degree n.)
$$
\int\frac{P_n(x)\mathrm{d}x}{\sqrt{ax^2+bx+c}} \equiv P_{n-1}(x)  \cdot\sqrt{ax^2+bx+c} + K\cdot\int\frac{\mathrm{d}x}{\sqrt{ax^2+bx+c}}, (a\neq0) 
$$
After finding the derivatives of both sides it is easy to find the coefficients of the polynomial $P_{n-1}(x)$. Then we are left with this simple integral:
$$\int\frac{\mathrm{d}x}{\sqrt{ax^2+bx+c}}$$
 [/INST] This is a special case of a technique known as Hermite reduction (here is the original article from 1872). It can be derived by means of the following identity,
$$\frac{d}{dx}\left(x^{n-1}\sqrt{ax^2+bx+c}\right)=\frac{c (n-1) x^{n-2}+b(n-1/2) x^{n-1}}{ \sqrt{a x^2+b x+c}}+\frac{a n x^n}{\sqrt{a x^2+b x+c}}.$$
So for $a\neq 0$ and $n\geq 1$ we have
$$\int \frac{x^n}{\sqrt{ax^2+bx+c}}dx=\frac{1}{an}x^{n-1}\sqrt{ax^2+bx+c}+\int\frac{P_{n-1}}{\sqrt{a x^2+b x+c}}.$$
We can now repeat this reduction on the integral with the polynomial $P_{n-1}(x)$ in the numerator, until we reach $P_0$, producing the identity in the OP.
</s>