When to do u-substitution and when to integrate by parts I'm in my first semester of calculus, so the problems I'm facing are about as hard as those on KhanAcademy calculus playlist. I'm currently doing integration, a somewhat difficult part of the course. Doing derivatives is mechanics; finding the integral is an art. 

The two main techniques showed are


u-substitution
integration by parts


My question is: are there any rules of thumb (preferably with a logical reason behind it) of when to use which?
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.
One thing you should remember is choose that function as u which when differentiated yield a less difficult function or may decrease its power or some such thing.  Also if we have cos or sin then differentiation of function will bring back the original \int uv in some form. What I feel while teaching is the "Tabular method" which is following Bernoulli's formula of \int uv.