I've been checking my homework via Wolfram Alpha, and for several questions (example below) in this section (trigonometric integrals). I'd be correct up until the last step, in which Wolfram Alpha pulls a complete switcharoo, stating "Which is equivalent for restricted x values to:..."
Can you please explain this to me? What restricted x values? (no restriction was specified). How would I know to do this?

As stated in my comment, Wolfram Alpha used the formula $tan^2x + 1 = sec^2x$ and put the 1 in the constant term to "simplify" the last . As for why WA did that, I believe they want to give you as many different expressions of the same quantity as they can so you can use whichever you prefer / whichever the exercice asks you to find.