Assuming[Element[n, Integers], Integrate[x Sin[Pi n x], {x, -1, 1}]]