By Claude:
The antiderivative that integrate(x*sec(x)^2,x) returns contains sin(2*x)^2+cos(2*x)^2, which is 1:
(%i1) display2d:false$
(%i2) integrate(x*sec(x)^2,x);
(%o2) ((sin(2*x)^2+cos(2*x)^2+2*cos(2*x)+1)*log(
sin(2*x)^2+cos(2*x)^2+2*cos(2*x)
+1)
+4*x*sin(2*x))
/(2*sin(2*x)^2+2*cos(2*x)^2+4*cos(2*x)+2)
The result is correct, but sin(2*x)^2+cos(2*x)^2+2*cos(2*x)+1 is just 2*cos(2*x)+2, which makes the result much longer than necessary and harder to work with. Many other trigonometric integrands give the same kind of result, for example x*tan(x)^2, x*csc(x)^2, x*sec(x)^4, x/(1+cos(x)) and log(sin(x)).