\[ \int \frac {(d+e x)^m \left (a+b x+c x^2\right )^2}{(f+g x)^2} \, dx \]
Optimal antiderivative \[ \frac {\left (b^{2} e^{2} g^{2}+c^{2} \left (d^{2} g^{2}+2 d e f g +3 e^{2} f^{2}\right )+2 c e g \left (a e g -b \left (d g +2 e f \right )\right )\right ) \left (e x +d \right )^{1+m}}{e^{3} g^{4} \left (1+m \right )}-\frac {2 c \left (-b e g +c d g +c e f \right ) \left (e x +d \right )^{2+m}}{e^{3} g^{3} \left (2+m \right )}+\frac {c^{2} \left (e x +d \right )^{3+m}}{e^{3} g^{2} \left (3+m \right )}+\frac {\left (a \,g^{2}-b f g +c \,f^{2}\right )^{2} \left (e x +d \right )^{1+m}}{g^{4} \left (-d g +e f \right ) \left (g x +f \right )}+\frac {\left (a \,g^{2}-b f g +c \,f^{2}\right ) \left (c f \left (4 d g -e f \left (4+m \right )\right )-g \left (a e g m +b \left (2 d g -e f \left (2+m \right )\right )\right )\right ) \left (e x +d \right )^{1+m} \hypergeom \! \left (\left [1, 1+m \right ], \left [2+m \right ], -\frac {g \left (e x +d \right )}{-d g +e f}\right )}{g^{4} \left (-d g +e f \right )^{2} \left (1+m \right )} \]
command
Integrate[((d + e*x)^m*(a + b*x + c*x^2)^2)/(f + g*x)^2,x]
Mathematica 13.1 output
\[ \int \frac {(d+e x)^m \left (a+b x+c x^2\right )^2}{(f+g x)^2} \, dx \]
Mathematica 12.3 output
\[ \frac {(d+e x)^{m+1} \left (\frac {2 c e g (a e g-b (d g+2 e f))+b^2 e^2 g^2+c^2 \left (d^2 g^2+2 d e f g+3 e^2 f^2\right )}{e^3 (m+1)}+\frac {e \left (g (a g-b f)+c f^2\right )^2 \, _2F_1\left (2,m+1;m+2;\frac {g (d+e x)}{d g-e f}\right )}{(m+1) (e f-d g)^2}-\frac {2 (2 c f-b g) \left (g (a g-b f)+c f^2\right ) \, _2F_1\left (1,m+1;m+2;\frac {g (d+e x)}{d g-e f}\right )}{(m+1) (e f-d g)}-\frac {2 c g (d+e x) (-b e g+c d g+c e f)}{e^3 (m+2)}+\frac {c^2 g^2 (d+e x)^2}{e^3 (m+3)}\right )}{g^4} \]