\[ \int \frac {(a+b \text {ArcTan}(c x))^2}{x (d+e x)} \, dx \]
Optimal antiderivative \[ -\frac {2 \left (a +b \arctan \! \left (c x \right )\right )^{2} \arctanh \! \left (-1+\frac {2}{1+\mathrm {I} c x}\right )}{d}+\frac {\left (a +b \arctan \! \left (c x \right )\right )^{2} \ln \! \left (\frac {2}{1-\mathrm {I} c x}\right )}{d}-\frac {\left (a +b \arctan \! \left (c x \right )\right )^{2} \ln \! \left (\frac {2 c \left (e x +d \right )}{\left (c d +\mathrm {I} e \right ) \left (1-\mathrm {I} c x \right )}\right )}{d}-\frac {\mathrm {I} b \left (a +b \arctan \! \left (c x \right )\right ) \polylog \! \left (2, 1-\frac {2}{1-\mathrm {I} c x}\right )}{d}-\frac {\mathrm {I} b \left (a +b \arctan \! \left (c x \right )\right ) \polylog \! \left (2, 1-\frac {2}{1+\mathrm {I} c x}\right )}{d}+\frac {\mathrm {I} b \left (a +b \arctan \! \left (c x \right )\right ) \polylog \! \left (2, -1+\frac {2}{1+\mathrm {I} c x}\right )}{d}+\frac {\mathrm {I} b \left (a +b \arctan \! \left (c x \right )\right ) \polylog \! \left (2, 1-\frac {2 c \left (e x +d \right )}{\left (c d +\mathrm {I} e \right ) \left (1-\mathrm {I} c x \right )}\right )}{d}+\frac {b^{2} \polylog \! \left (3, 1-\frac {2}{1-\mathrm {I} c x}\right )}{2 d}-\frac {b^{2} \polylog \! \left (3, 1-\frac {2}{1+\mathrm {I} c x}\right )}{2 d}+\frac {b^{2} \polylog \! \left (3, -1+\frac {2}{1+\mathrm {I} c x}\right )}{2 d}-\frac {b^{2} \polylog \! \left (3, 1-\frac {2 c \left (e x +d \right )}{\left (c d +\mathrm {I} e \right ) \left (1-\mathrm {I} c x \right )}\right )}{2 d} \]
command
Integrate[(a + b*ArcTan[c*x])^2/(x*(d + e*x)),x]
Mathematica 13.1 output
\[ \int \frac {(a+b \text {ArcTan}(c x))^2}{x (d+e x)} \, dx \]
Mathematica 12.3 output
\[ \frac {24 c d \log (x) a^2-24 c d \log (d+e x) a^2-24 b \left (-\sqrt {\frac {c^2 d^2}{e^2}+1} e e^{i \tan ^{-1}\left (\frac {c d}{e}\right )} \tan ^{-1}(c x)^2+i c d \tan ^{-1}(c x)^2+e \tan ^{-1}(c x)^2-2 i c d \tan ^{-1}\left (\frac {c d}{e}\right ) \tan ^{-1}(c x)-2 c d \log \left (1-e^{2 i \tan ^{-1}(c x)}\right ) \tan ^{-1}(c x)+2 c d \log \left (1-e^{2 i \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )}\right ) \tan ^{-1}(c x)+i c d \pi \tan ^{-1}(c x)+c d \pi \log \left (1+e^{-2 i \tan ^{-1}(c x)}\right )+2 c d \tan ^{-1}\left (\frac {c d}{e}\right ) \log \left (1-e^{2 i \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )}\right )+\frac {1}{2} c d \pi \log \left (c^2 x^2+1\right )-2 c d \tan ^{-1}\left (\frac {c d}{e}\right ) \log \left (\sin \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )\right )+i c d \text {Li}_2\left (e^{2 i \tan ^{-1}(c x)}\right )-i c d \text {Li}_2\left (e^{2 i \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )}\right )\right ) a+b^2 \left (16 \sqrt {\frac {c^2 d^2}{e^2}+1} e e^{i \tan ^{-1}\left (\frac {c d}{e}\right )} \tan ^{-1}(c x)^3-16 e \tan ^{-1}(c x)^3+24 c d \log \left (1-e^{-2 i \tan ^{-1}(c x)}\right ) \tan ^{-1}(c x)^2-48 c d \log \left (1-e^{2 i \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )}\right ) \tan ^{-1}(c x)^2+24 c d \log \left (-e^{2 i \tan ^{-1}\left (\frac {c d}{e}\right )} \cos \left (2 \tan ^{-1}(c x)\right )-i e^{2 i \tan ^{-1}\left (\frac {c d}{e}\right )} \sin \left (2 \tan ^{-1}(c x)\right )+1\right ) \tan ^{-1}(c x)^2-24 c d \pi \log \left (1+e^{-2 i \tan ^{-1}(c x)}\right ) \tan ^{-1}(c x)-48 c d \tan ^{-1}\left (\frac {c d}{e}\right ) \log \left (1-e^{2 i \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )}\right ) \tan ^{-1}(c x)+24 c d \pi \log \left (-\frac {2 i}{c x-i}\right ) \tan ^{-1}(c x)-48 c d \tan ^{-1}\left (\frac {c d}{e}\right ) \log \left (\frac {e^{-i \tan ^{-1}\left (\frac {c d}{e}\right )} \left (c x+e^{2 i \tan ^{-1}\left (\frac {c d}{e}\right )} (c x-i)+i\right )}{2 \sqrt {c^2 x^2+1}}\right ) \tan ^{-1}(c x)+48 c d \tan ^{-1}\left (\frac {c d}{e}\right ) \log \left (-e^{2 i \tan ^{-1}\left (\frac {c d}{e}\right )} \cos \left (2 \tan ^{-1}(c x)\right )-i e^{2 i \tan ^{-1}\left (\frac {c d}{e}\right )} \sin \left (2 \tan ^{-1}(c x)\right )+1\right ) \tan ^{-1}(c x)+48 c d \tan ^{-1}\left (\frac {c d}{e}\right ) \log \left (\sin \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )\right ) \tan ^{-1}(c x)+24 i c d \text {Li}_2\left (e^{-2 i \tan ^{-1}(c x)}\right ) \tan ^{-1}(c x)+24 i c d \text {Li}_2\left (e^{2 i \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )}\right ) \tan ^{-1}(c x)+12 c d \text {Li}_3\left (e^{-2 i \tan ^{-1}(c x)}\right )-12 c d \text {Li}_3\left (e^{2 i \left (\tan ^{-1}\left (\frac {c d}{e}\right )+\tan ^{-1}(c x)\right )}\right )-i c d \pi ^3\right )}{24 c d^2} \]