Critical Dimension of Bosonic Strings and Regularization of $\sum_{n=1}^\infty n$ If $D$ is critical dimension of Bosonic strings, a particular derivation goes like the following, where we arrive finally at 
$$ \frac{D-2}{2}\sum_{n=1}^\infty n + 1 = 0. $$
Now mathematically this is clearly a divergent series, but using zeta function regularization here we are taking 
$$ \sum_{n=1}^\infty n = \zeta(-1) = -\frac{1}{12}. $$
And obtain $ D = 26 $ where $\zeta $ is the analytic continuation of the zeta function we know. But it makes no sense in putting $ s = -1 $ in the formulae
$$ \zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}. $$
As the above is only valid for $ Re(s) > 1 $. So what is going on in here? Can anyone give me a reasonable explanation about obtaining $ -1/12 $? 
 A: A way to do this is using regularization by substracting a continuous integral, ,with the help of the Euler-MacLaurin formula:
You can write : 
$$ \sum_{Regularized} =(\sum_{n=0}^{+\infty}f(n) - \int_0^{+\infty} f(t) \,dt) = \frac{1}{2}(f(\infty) + f(0)) + \sum_{k=1}^{+\infty} \frac{B_k}{k!} (f^{(k - 1)} (\infty) - f^{(k - 1)} (0))$$
where $B_k$ are the Bernoulli numbers.
With the function $f(t) = te^{-\epsilon t}$, with $\epsilon > 0$, you have $f^{(k)}(\infty) = 0$ and $f(0) = 0$, so with the limit $\epsilon \rightarrow 0$, you will find : 
$$\sum_{Regularized} = -  \frac{B_1}{1!} f (0) -  \frac{B_2}{2!} f' (0) = - \frac{1}{12}$$
because $f(0) = 0$ and $B_2 = \frac{1}{6}$
A: I know some derivations in which one can track the emergence of the concrete value, without having to buy that the second order contribution in the Euler-MacLaurin formula (see other answer) is $-\frac{1}{2!}$ times the second Bernoulli number $B_2$.

The limit $\lim_{z\to 1}$ of the sum
$0+1\,z^1+2\,z^2+3\,z^3+\dots$ 
diverges, because of the pole in
$\sum_{k=0}^\infty k\,z^k=z\frac{{\mathrm d}}{{\mathrm d}z}\sum_{k=0}^\infty z^k=z\frac{{\mathrm d}}{{\mathrm d}z}\frac{1}{1-z}=\frac{z}{(z-1)^2}, \hspace{1cm} z\in(0,1)$
We are instead going to consider the sum of smooth deviations of the above, using the local mean
$\langle f(k)\rangle:=\int_{k}^{k+1}f(k')\,{\mathrm d}k'$. 
for which
$\langle k\,z^k\rangle=z\frac{{\mathrm d}}{{\mathrm d}z}\langle z^k\rangle=z\frac{{\mathrm d}}{{\mathrm d}z}\langle {\mathrm e}^{k \log(z)}\rangle=z\frac{{\mathrm d}}{{\mathrm d}z}\frac{z^{k'}}{\log(z)}\left|_{k}^{k+1}\right.$.
Because of canceling upper and lower bounds, the sum $\sum_{k=0}^n\langle k\,z^k\rangle$ is $\frac{z^0}{\log(z)^2}$ plus terms suppressed by $z^n$.
Finally, using the expansion
$\dfrac{1}{\left(\log(1+r)\,/\,r\right)^2}=\dfrac{1}{1-r+\left(1-\frac{1}{1!\,2!\,3!}\right)r^2+{\mathrm{O}}(r^3)}=1+r+\dfrac{1}{1!\,2!\,3!}r^2+{\mathrm{O}}(r^3),$
we find
$\sum_{k=0}^\infty \left(k\,z^k-\langle k\,z^k\rangle\right)=\dfrac{z}{(z-1)^2}-\dfrac{1}{\log(z)^2}=-\dfrac{1}{12}+{\mathcal O}\left((z-1)^1\right).$

The picture shows the two functions $\dfrac{z}{(z-1)^2}$ and $\dfrac{1}{\log(z)^2}$, as well as their difference (blue, red, yellow). While the functions themselves clearly have a pole at $z=1$, their difference converges against 
$$-\frac{1}{1!\,2!\,3!}=-\frac{1}{12}=-0.08{\dot 3}.$$

