Use integration by parts when the integrand factors into two things that both include the variable, but integration by substitution doesn't work!
We can use integration by parts on
because we can factor the x2 to get
and choose u = x and v' = xex2.
We wouldn't use integration by parts on
because this integral begs for substitution.