The integration by parts rule looks like this:
∫ u * v' dx = u * v - ∫ ( v * u' ) dx
Hence in this example, we want to make our u = x and v' = sinx
So we now need to work out what u' and v are:
u' = 1 which is the easier of the two; to work out v, we should integrate v' = sinx, this will give us v = -cosx
Hence if we now subsititute these into the equations, we will find that:
∫ xsinx dx = -xcosx - ∫ (-cosx) dx
= -xcosx - (-sinx) + C (where C is the constant of integration)
= sinx - xcosx + C