\[ \int \frac {\left (-1+2 k^2\right ) x-2 k^4 x^3+k^4 x^5}{\left (\left (1-x^2\right ) \left (1-k^2 x^2\right )\right )^{2/3} \left (-1+d+\left (1-2 d k^2\right ) x^2+d k^4 x^4\right )} \, dx \]
Optimal antiderivative \[ -\frac {\sqrt {3}\, \arctan \left (\frac {\sqrt {3}\, d^{\frac {1}{3}} \left (1+\left (-k^{2}-1\right ) x^{2}+k^{2} x^{4}\right )^{\frac {2}{3}}}{2-2 x^{2}+d^{\frac {1}{3}} \left (1+\left (-k^{2}-1\right ) x^{2}+k^{2} x^{4}\right )^{\frac {2}{3}}}\right )}{2 d^{\frac {2}{3}}}-\frac {\ln \left (-1+x^{2}+d^{\frac {1}{3}} \left (1+\left (-k^{2}-1\right ) x^{2}+k^{2} x^{4}\right )^{\frac {2}{3}}\right )}{2 d^{\frac {2}{3}}}+\frac {\ln \left (1-2 x^{2}+x^{4}+\left (d^{\frac {1}{3}}-d^{\frac {1}{3}} x^{2}\right ) \left (1+\left (-k^{2}-1\right ) x^{2}+k^{2} x^{4}\right )^{\frac {2}{3}}+d^{\frac {2}{3}} \left (1+\left (-k^{2}-1\right ) x^{2}+k^{2} x^{4}\right )^{\frac {4}{3}}\right )}{4 d^{\frac {2}{3}}} \]
command
Integrate[((-1 + 2*k^2)*x - 2*k^4*x^3 + k^4*x^5)/(((1 - x^2)*(1 - k^2*x^2))^(2/3)*(-1 + d + (1 - 2*d*k^2)*x^2 + d*k^4*x^4)),x]
Mathematica 13.1 output
\[ \frac {\left (-1+x^2\right )^{2/3} \left (-1+k^2 x^2\right )^{2/3} \left (2 \sqrt {3} \text {ArcTan}\left (\frac {\sqrt {3} \sqrt [3]{d} \left (-1+k^2 x^2\right )^{2/3}}{2 \sqrt [3]{-1+x^2}-\sqrt [3]{d} \left (-1+k^2 x^2\right )^{2/3}}\right )-2 \log \left (\sqrt [3]{-1+x^2}+\sqrt [3]{d} \left (-1+k^2 x^2\right )^{2/3}\right )+\log \left (\left (-1+x^2\right )^{2/3}-\sqrt [3]{d} \sqrt [3]{-1+x^2} \left (-1+k^2 x^2\right )^{2/3}+d^{2/3} \left (-1+k^2 x^2\right )^{4/3}\right )\right )}{4 d^{2/3} \left (\left (-1+x^2\right ) \left (-1+k^2 x^2\right )\right )^{2/3}} \]
Mathematica 12.3 output
\[ \int \frac {\left (-1+2 k^2\right ) x-2 k^4 x^3+k^4 x^5}{\left (\left (1-x^2\right ) \left (1-k^2 x^2\right )\right )^{2/3} \left (-1+d+\left (1-2 d k^2\right ) x^2+d k^4 x^4\right )} \, dx \]________________________________________________________________________________________