Integral test for convergence? Why does the series' terms have to be non-negative to use the integral test?

Consider the series:

$$\sum_{n = 1}^{\infty}\frac{n\cos n - \sin n}{n^2}$$

Even though it has negative terms, why can't the integral test be used with the integral being:

$$\int_1^\infty\frac{x\cos x - \sin x}{x^2}$$

Since the series can be interpreted as the Riemann sum of the function above?
It's precisely the fact that it has infinitely-many negative terms; the Integral Test only works when the sequence $a_n$ we're taking the series of is the restriction of a positive non-increasing integrable function $f(x)$.  To understand why, it is useful to understand the general idea of the proof of the integral test.  At this site is a good illustration of the Riemann sums being taken and how they actually relate to the infinite series (this is one of the nice examples when the proof is essentially the picture).
Assume the following series:

$$ \sum_{n=1}^\infty \cos(\pi n) = \sum_{n=1}^\infty \pm 1$$ 
As you might know this series does not converge!

But if you look at the Riemann integral you have:

$$ \lim_{n\to\infty} \int_{1}^n \cos(x\pi)\text{d}x = 0 $$