Substitution
The most basic trick for doing integrals is $u$substitution. The simplest uses involve taking $u=ax$ or $u=ax+b$, e.g. computing $\displaystyle\int \cos\left(3x+1\right)\,dx$. More sophisticated uses involve clever choices of $u$. There is no single rule for how to pick $u$. It takes practice to get a feel for it.
Sometimes we want to do $u$substitution in reverse: instead of writing $u=g(x)$, we write $$x=h(\theta), \quad \text{ so } \quad dx= h'(\theta) \,d\theta.$$ This is especially useful when the integrand contains $x^2+a^2$, $x^2a^2$ or $a^2x^2$.
Example: $$\int x \sin\left(x^2+3\right) \,dx = \overset{\fbox{$ u\,=\,x^2+3\\du\,=\,2x\,dx$}}{=} \frac{1}{2} \int\sin u\,du = \frac{1}{2}\cos u + C = \frac{1}{2}\cos\left(x^2+3\right) + C$$

