Sum[n^2 Exp[2Pi I/N n(x-x_1)],{n,-N/2,N/2-1}]