It only equals −1/12 under a very specific interpretation. Walk through what's actually happening.
Partial sums climb without bound — drag the slider to push N higher. There's no real number this approaches.
By the ordinary definition of a sum (the limit of partial sums), 1 + 2 + 3 + … does not equal −1/12. It doesn't equal anything — the series diverges. The −1/12 value comes from a different procedure that assigns a finite value to divergent series. The next tabs show how.
The Riemann zeta function is ζ(s) = 1−s + 2−s + 3−s + … This series only converges when s > 1 (the right half of the graph). Outside that, the formula is meaningless — but the function ζ(s) itself can be analytically continued to the rest of the complex plane, giving a unique smooth extension. That extension has a definite value at s = −1: ζ(−1) = −1/12.
If you naively plug s = −1 into the original series, you get 1 + 2 + 3 + … So the statement "1 + 2 + 3 + … = −1/12" is shorthand for "the analytic continuation of the zeta function evaluated at s = −1 is −1/12." That is a real, well-defined mathematical statement — just not a statement about ordinary addition.
Two uncharged metal plates in a vacuum attract each other. The textbook derivation sums the zero-point energies of all electromagnetic modes between the plates, which gives a divergent series of the form 1+2+3+… Regularize it with ζ(−1) = −1/12 and you predict a force per unit area of πℏc / 480 d4, which matches lab measurements to within a few percent. (Lamoreaux 1997, then a series of more precise experiments.)
Quantizing the bosonic string demands the ground-state energy work out to a specific value. The calculation contains 1+2+3+…, regularized to −1/12, which fixes the number of spacetime dimensions at exactly 26. Without that regularization the theory is inconsistent. Superstring theory tightens it further to 10 dimensions by an analogous trick.
Any QFT calculation that runs over infinitely many modes (vacuum energy, particle self-energy, certain anomaly cancellations) hits divergent sums like this. Zeta-function regularization is one of the standard tools for extracting finite, physically meaningful answers.
So the −1/12 isn't a "trick that happens to work in physics" — it's the unique self-consistent value the divergent sum must take if you want algebra and analytic continuation to behave sensibly. Physics finds the same number because the same uniqueness argument applies.