Is this a $u$-substitution? Weird integral. $$\int\frac{dx}{(1+x^2)^2}$$
Here, $$x=\tan\theta, dx=\sec^2\theta\,d\theta$$
$$1+x^2 = 1+\tan^2\theta = \sec^2 \theta$$
So we have now that,
$$\int\frac{dx}{(1+x^2)^2} = \int \frac{\sec^2 \theta}{\sec^4 \theta} d\theta$$
I have no idea what just happened. I know how to do $U$-sub, but how can you just set $X$ to be something?   Normally, you set $u=f(x)$ and go from there.  You never set $X$ equal to something.  Is this something different?
PS:  I tried integrating by partial fractions, and got right back to the initial integral.
 A: No this is not anything different.
$x$ is a real variable taking all values in $\mathbb{R}$ i.e. $x$ varies from $-\infty$ to $+\infty$  whereas $\tan \theta$ takes all real values from $-\infty$ to $+\infty$.
So, for simplification of calculation, you can assume $x=\tan \theta$ without any loss of generality. The domain of the variable is kept intact whereas the job of integration becomes very easy by this substitution.
A: Both ways are possible and used.
1) substitute $x=\phi(u)$, i.e. $dx=\phi'(u)\,du$. This gives
$$\int f(x)dx=\int f(\phi(u)) \phi'(u)du=F(u)+C=F(\phi^{-1}(x))+C.$$
2) substitute $u=\psi(x)$, i.e. $du=\psi'(x)\,dx$ or $dx=\dfrac{du}{\psi'(x)}=\dfrac{du}{\psi'(\psi^{-1}(u))}$. This gives
$$\int f(x)dx=\int\frac{f(\psi^{-1}(u))}{\psi'(\psi^{-1}(u))}du=G(u)+C=G(\psi(x))+C.$$
In both approaches you need to know the transform, its derivative and its inverse.
A: Actually, performing a substitution by setting the integration variable ($x$ in this case) to a function of some other variable ($\theta$ here) is far more natural that the $u$-substitution you speak of.  Why?  Because setting $x = g(\theta)$, we can find the differential $dx$ directly by simply taking the derivative $g'(\theta)$.  In contrast, the $u$ substitution requires an inversion of the function $u=f(x)$ before we take the derivative to find $du$ in terms of $dx$.  
So, yes, setting $x$ to some $g(u)$ is much nicer than setting $u=f(x)$ in an integration by substitution.
A: In fact, the basic theorem on substitution (SEE THIS) states that if $g$ is a continuously differentiable function then
$$\int f(x)\,dx=\int f(g(u))g'(u)\,du$$
where $x=g(u)$.  The validity of this transformation/change of variables is a direct consequence of the Fundamental Theorem of Calculus.
If one begins instead with $u=h(x)$ - the "u" substitution - then one would obtain
$$\begin{align}
\int f(x)\,dx&=\int f(h^{-1}(u))\left.\left(\frac{1}{h'(x)}\right)\right|_{x=h^{-1}(u)}\,du\\\\
&=\int f(h^{-1}(u))\,\frac{d\,h^{-1}(u)}{du}\,du
\end{align}$$
where in arriving at the last line we made use of THIS THEOREM in Inverse Functions and Differentiation.

As a request from the OP, here is a simple example of integration by substitution.  
Let $f(x)=\sqrt{x}$.  Let $x=u^2$ so that $dx=2u\,du$.  Then, we have
$$\int \sqrt{x}\,dx=\int |u|\,2u\,du=\frac23 \text{sgn(u)}\,u^3+C=\frac23 x^{3/2}+C$$
Alternatively, we could have proceeded by letting $u=\sqrt{x}$.  Then, $du=\frac{1}{2\sqrt{x}}\,dx$ which implies that $dx=2u\,du$.  Then, we have
$$\int \sqrt{x}\,dx=\int u\,2u\,du=\frac23 u^3+C=\frac23 x^{3/2}+C$$
as expected. 
A: I would process this integral like this:
$$\int\frac{dx}{(x^2+1)^2}=\int \frac{d\arctan(x)}{x^2+1}=\int\frac{du}{\tan^2(u)+1}=\int\cos^2(u)\,du.$$
Then I know that by a trigonometric transform (double angle) this becomes trivial.
