You can't code an infinite sum exactly, but fortunately, this one is bounded (x^2 on the denominator and the numerator is bounded between -1 and 1).
Pick a big n:
ns = 1:n_max;
sum_n = cumsum( sin(2*ns)./ns.^2);
You will see it very quickly converges, after 20 terms or so.