emlekarc said:
how do you know when to use iteration by parts, or use substituion
You ask a question which can be answered, but if we answer it for you it robs you the joy of discovering that yourself! So as others have said it is best recommended to practice and find when one technique is more suited than another. It helps not only to solve an ensemble of questions, but to take a higher position and invent questions! You will try to tinker and totter and tailor the problem around one technique! It is this vantage point that will give you your insight.
If you insist though, it is our duty to reply, no matter the hesitation it might cause. In short, the practice goes like this:
(1) always "look" for substitutions: find quantities which if exchanged with some other variable, has its derivative contained in the integrand.
For example, if I am integrating an x/(x^2-1), it is immediately advantageous to recast the denominator as a variable u since its derivative is, modulo some constant, the rest of the integrand itself!
(2) If above fails, resort to your next simple techniques (when you learn them, they might be trigonometric substitutions).
(3) If all of the above fails, it is here you concede to integration by parts, as usually it is the most exceeding in effort to calculate. Think of the method as a reverse product rule. Re-write the integrand as a derivative of the product and watch the magic happen.
For example, If I am integrating x cos(x), I might rewrite that as the derivative of the product x sin(x) subtracted from the term I was otherwise not entitled too (that is, I will additionally minus away the sin(x). I than notice that integrating the d/dx (x sin(x)) - sin(x) is fantastically easier than when in the original form.