Write #f : x mapsto x sin(x)#.
Because #f(-x) = f(x)# for all #x in [-pi , pi]#, you can say that
#int_(-pi)^pi f(x) dx = 2 int_0^pi f(x) d x#.
Now, use integration by parts with
#u (x) = x# and #v(x) = -cos(x)#.
The functions #u,v# are #C^1# on #[0,pi]# and
#u'(x) = 1# and #v'(x) = sin(x)#.
The integration by parts says that
#int_0^pi u(x)v'(x) dx = [u(x)v(x)]_0^pi - int_0^pi u'(x)v(x) dx#,
therefore,
#int_0^pi x sin(x) dx = [-x cos(x)]_0^pi + int_0^pi cos(x) dx#
#int_0^pi x sin(x) dx = 1 + [sin(x)]_0^pi = 1#.
Finally, #int_(-pi)^pi x sin(x) dx =2int_0^pi x sin(x) dx = 2#.