\[ \int (c+d x) \left (a+b (c+d x)^2\right )^p \, dx \]
Optimal antiderivative \[ \frac {\left (a +b \left (d x +c \right )^{2}\right )^{1+p}}{2 b d \left (1+p \right )} \]
command
integrate((d*x+c)*(a+b*(d*x+c)**2)**p,x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \begin {cases} \frac {c x}{a} & \text {for}\: b = 0 \wedge d = 0 \wedge p = -1 \\a^{p} \left (c x + \frac {d x^{2}}{2}\right ) & \text {for}\: b = 0 \\c x \left (a + b c^{2}\right )^{p} & \text {for}\: d = 0 \\\frac {\log {\left (\frac {c}{d} + x - \frac {\sqrt {- a b}}{b d} \right )}}{2 b d} + \frac {\log {\left (\frac {c}{d} + x + \frac {\sqrt {- a b}}{b d} \right )}}{2 b d} & \text {for}\: p = -1 \\\frac {a \left (a + b c^{2} + 2 b c d x + b d^{2} x^{2}\right )^{p}}{2 b d p + 2 b d} + \frac {b c^{2} \left (a + b c^{2} + 2 b c d x + b d^{2} x^{2}\right )^{p}}{2 b d p + 2 b d} + \frac {2 b c d x \left (a + b c^{2} + 2 b c d x + b d^{2} x^{2}\right )^{p}}{2 b d p + 2 b d} + \frac {b d^{2} x^{2} \left (a + b c^{2} + 2 b c d x + b d^{2} x^{2}\right )^{p}}{2 b d p + 2 b d} & \text {otherwise} \end {cases} \]
Sympy 1.8 under Python 3.8.8 output
\[ \text {Timed out} \]________________________________________________________________________________________