When to do u-substitution and when to integrate by parts
Always do a $u$-sub if you can; if you cannot, consider integration by parts.
A $u$-sub can be done whenever you have something containing a function (we'll call this $g$), and that something is multiplied by the derivative of $g$. That is, if you have $\int f(g(x))g'(x)dx$, use a u-sub.
Integration by parts is whenever you have two functions multiplied together--one that you can integrate, one that you can differentiate.
My strategy is to try to "play it out" in my mind and try to see which one will work better. The best way to get better at these sorts of integrals is to practice large sets of each type. Then, you start to think "Oh--this looks like a u-sub!" or, "maybe by-parts is better for this." Practice is really the best way to get better at recognizing each type.
U-substitution is for functions that can be written as the product of another function and its derivative. $$\int u du$$
Integration by parts is for functions that can be written as the product of another function and a third function's derivative.
$$\int u dv$$
A good rule of thumb to follow would be to try u-substitution first, and then if you cannot reformulate your function into the correct form, try integration by parts.