\[ \int \tan ^m(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx \]
Optimal antiderivative \[ \frac {\mathrm {I} a B \left (\tan ^{1+m}\left (d x +c \right )\right )}{d \left (1+m \right )}+\frac {a \left (A -\mathrm {I} B \right ) \hypergeom \! \left (\left [1, 1+m \right ], \left [2+m \right ], \mathrm {I} \tan \! \left (d x +c \right )\right ) \left (\tan ^{1+m}\left (d x +c \right )\right )}{d \left (1+m \right )} \]
command
Integrate[Tan[c + d*x]^m*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]
Mathematica 13.1 output
\[ \int \tan ^m(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx \]
Mathematica 12.3 output
\[ -\frac {i a e^{-i c} 2^{-m-1} \left (-\frac {i \left (-1+e^{2 i (c+d x)}\right )}{1+e^{2 i (c+d x)}}\right )^{m+1} \cos ^2(c+d x) (1+i \tan (c+d x)) (A+B \tan (c+d x)) \left (-B 2^{m+1}+(B+i A) \left (1+e^{2 i (c+d x)}\right )^{m+1} \, _2F_1\left (m+1,m+1;m+2;\frac {1}{2} \left (1-e^{2 i (c+d x)}\right )\right )\right )}{d (m+1) (\cos (d x)+i \sin (d x)) (A \cos (c+d x)+B \sin (c+d x))} \]