number of terms of a sum required to get a given accuracy

How do I find the number of terms of a sum required to get a given accuracy. For example a text says that to get the sum $\zeta(2)=\sum_{n=1}^{\infty}{\frac{1}{n^2}}$ to 6 d.p. of accuracy, I need to add 1000 terms. How do in find it for a general series?

If you have a sum $S=\sum_{n=1}^{\infty} a(n)$ that you want to estimate with a partial sum, denote by $R$ the residual error $$R(N) = S-\sum_{n=1}^N a(n) = \sum_{n=N+1}^\infty a(n)$$

If all $a(n)$ are nonnegative then $R(N)\ge a(N+1)$, so to estimate within a given accuracy $\epsilon$ you need $N$ at least large enough that $a(N+1)<\epsilon$.

So you can tell that to get $\sum_{n=1}^{\infty}\frac{1}{n^2}$ to six decimal places of accuracy, i.e. within $\frac{1}{1000000}$, you will need at least 1000 terms, since for $n\le 1000$ each new term is at least that size.

Unfortunately this is not sufficient. If $a(n)$ shrinks slowly $R(N)$ may be much bigger than $a(N+1)$. For your example 1000 terms is only accurate to about $1/1000$: $$\zeta(2)=1.64493\cdots ~~,~~ \sum_{n=1}^{1000}\frac{1}{n^2}=1.64393\cdots$$

If you can find a decreasing function $b$ on $\mathbb R$ that is an upper bound $b(n)\ge a(n)$ at the integers, then you can bound $R(N)$ by observing that $$\int_{N}^{N+1} b(x)dx > \min_{N\le x\le N+1} b(x) = b(N+1)\ge a(N+1) \\ \int_{N+1}^{N+2} b(x)dx > b(N+2)\ge a(N+2) \\ \cdots \\ \int_{N}^\infty b(x)dx > R(N)$$ For $\zeta(2)$ choose $b(x)=x^{-2}$, then $R(N)<N^{-1}$, so for 6 decimal places $10^6$ terms would suffice.