\[ \int \frac {\cot ^5(e+f x)}{a+b \tan ^2(e+f x)} \, dx \]
Optimal antiderivative \[ \frac {\left (a +b \right ) \left (\cot ^{2}\left (f x +e \right )\right )}{2 a^{2} f}-\frac {\cot ^{4}\left (f x +e \right )}{4 a f}+\frac {\ln \! \left (\cos \! \left (f x +e \right )\right )}{\left (a -b \right ) f}+\frac {\left (a^{2}+a b +b^{2}\right ) \ln \! \left (\tan \! \left (f x +e \right )\right )}{a^{3} f}+\frac {b^{3} \ln \! \left (a +b \left (\tan ^{2}\left (f x +e \right )\right )\right )}{2 a^{3} \left (a -b \right ) f} \]
command
integrate(cot(f*x+e)**5/(a+b*tan(f*x+e)**2),x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {Timed out} \]
Sympy 1.8 under Python 3.8.8 output
\[ \text {output too large to display} \]