Okay, I do know that there are three ways of showing that it equals $-1\over 12$:
1) The Reimann zeta function calculated for $-1$(see picture)
2) The one involving Grandi's series, the series $1-2+3-4+5..$ , and then finally getting $1+2+3+4+5...$.
3)Ramanujan's method of equating it to a constant, and subtracting $4$ times that equation from itself, and solving.
But, I have also seen a person solve it this way: $$1+2+3+4+5+6..=n$$ $$1+(2+3+4)+(5+6+7)+(8+9+10)..=n$$ $$1+9+18+27+...=n$$ $$1+9(1+2+3..)=n$$ $$1+9n=n$$ $$1=-8n$$ $$n=\frac{-1}{8}$$
I am torn between the two. I know that the previous value is used and accepted by string theorists, but what about the second one? Is it valid mathematically? Or are both, due to infinity being infinity?
Edit: I added this picture after YiFan's answer.

Introduction
The often seen "proofs" of the incorrect statement that $1+2+... = \frac{-1}{12}$ attempt to assign values to "divergent series" i.e. infinite sums which cannot be assigned a real value due to issues regarding consistency of the underlying number mathematics(as explained below). I attempt to explain a few things in this answer :
Why infinite sums are different from finite sums and must be treated so.
Why some infinite sums are special and admit finite sum like treatment, although not in entirety.
The link between the Riemann Zeta function and infinite sums, and why the formula often mistaken to define the entire function is incorrect.
The actual definition of the Riemann Zeta function, with the concept of analytic continuation and his functional equation.
The result that $\zeta(-1) = \frac{-1}{12}$ : where it comes from, and how it links to the infinite sum in question.
Infinite sums are different from finite sums
We all know what the sum of two real/complex numbers are. I will not elaborate here.
This can be used to define the sum of any $n$ given real/complex numbers, since we may do it recursively i.e. add the first $n-1$ of them, then add the last number to the result. For example , if we need to add $1,2,3$, we first add $1,2$ to get $3$, and then add $3$ to this to get $6$.
It is a fact that a finite sum can be rearranged : it does not matter if I add the last two terms together, then any others, etc.
But an infinite sum? How am I supposed to add $1+2+3+...$? Do I add $1+2$ first, then $3$, then $4$, and so on? Or maybe I can add $57$ and $745$ first, then $9564$, then $8$, ad infinitum.
The good samaritan thinks that it doesn't matter really : they are just infinite sums. But think : how do you define an infinite sum? You can't do it recursively : removing one element from an infinite sum still leaves you with an infinite sum! Then, there are these headaches to contend with.
History is not at all bereft of examples of "infinite sums" that behave weirdly. For example, consider the "infinite sum" $1-1+1-1+....$. Let us do what all good samaritans do and write $x = 1-1+1-...$. Consider $$1-x = 1 - (1-1+1-1+)... = 1-1+1-1+... = x$$
And therefore, $x = \frac 12$.
Now, let us also do what all good samaritans do, and think : what order do I have to add the terms of $1-1+1-1+...$ to get $\frac 12$? But then, the sum of integers should be an integer : how can $x$ be a fraction?
The good samaritan thinks harder, and comes up with an even better example : let's consider $1+1+1+...$. He does the usual : $x = 1+1+....$ . Then, he notices : $$ 1+x = 1+(1+1+...) = 1+1+... = x $$
and so $1+x = x$. "Cancelling the $x$", we get $1=0$. Cue screeches across the school corridor, and animated discussions regarding the equality of two of the most fundamentally unequal quantities in the history of mathematics. Mathematics would collapse if these were equal.
Being the smarter of us two, you will have realized that anything resulting in $1=0$ must have very faulty foundations.
The moral of the above stories is this : infinite sums are not finite sums : they require separate rigorous treatment, and need to be inducted very carefully into the fabric of mathematics already existing, so that little to no disturbance is caused. Essentially, what is required is a guarantee for us to play with infinite series the same way we play with finite series : add them in any order, treat them as real/complex numbers, basically identify them as one with the finite sum community.
Unfortunately, this is not quite possible with all infinite sums: some will always remain outcasts, and just cannot behave the way finite sums do. Examples include those I gave above.
And then, there are infinite sums which fit the bill.
The good fellows
Examples of good fellows include the "much discussed" geometric series, which is probably the first infinite series you (will/have already) come across. This is the infinite sum $1+\frac 12 + \frac 14 + \frac 18 + ...$.
Let me discuss how we conclude that this infinite sum is well behaved. What we do, is take the first $n$ terms of this infinite sum, add them up, and look at the sequence of those sums. This looks like $1,\frac 32,\frac 74, \frac{15}8,\frac{31}{16},...$
It is not difficult to notice two things : one , that this sequence is increasing. The second, is that it keeps going closer to $2$ : infact, by going sufficiently far enough in the sequence, we can get as close to $2$ as we like.
Since $2$ is a nice little real number, we conclude that the infinite sum $1 + \frac 12+ \frac 14 + ...$ is equal to $2$.
And that, my good samaritans, is the idea behind convergent sums.
NOTE TO SELF : Remember to inform anybody reading this that infinity, or $\infty$, is not a real number. So, an infinite sum cannot equal infinity, just because it is forever increasing, like $1+1+...$. However, we do see often in textbooks and online notes, that infinite sums which grow farther than any real number are often symbolically equated to $\infty$ like so : $1+1+1+... = \infty$, but this is just a way of saying that the infinite sum is divergent, and is not well behaved.
Let's take another example : $1 - \frac 12 + \frac 13 - \frac 14 + ...$.Using the definition that we have, we take the sum of the first $n$ terms, and form a sequence out of that : $1, 0.5,0.833,0.5833,0.7833,0.6166,0.7595,...$
Plot these on a graph. These numbers seem to be getting closer to each other, isn't it? The difference between successive numbers is getting smaller. This leads to what is called a Cauchy sequence : one in which the numbers can be made as close to each other as desired by going as far down the sequence as desired.
The big result is that a Cauchy sequence is convergent : essentially , if there is a sequence of real numbers such that they seem to be getting closer to each other as we go down the sequence, then the result is that there is a real number that they are all getting closer to.
That real number given by the result above, is then the value of the infinite sum $1-\frac 12 + \frac 13 - \frac 14 + ...$, and as a matter of fact, the exact value is $\ln 2$.
Now, what we want to sum the terms in any order we wanted? The problem is, that sometimes nice infinite sums don't submit themselves to rearrangement.
For example, the above sequence can be rearranged as : $$ \left(1 + \frac 13 - \frac 12\right) +\left (\frac 15 + \frac 17 - \frac 14\right) + \left(\frac 19 + \frac 1{11} - \frac 16\right) + ... = \frac 32 \ln 2 $$
(See if you can spot the pattern of terms) which comes about again when you treat each bracket as a separate term, again form a sequence by summing the first $n$ terms, and then noticing convergence : to a different real number.
So all sequences can't be rearranged. But some can.
An infinite sum is absolutely convergent if the infinite sum of the absolute values $ |a_n|$ exists as a real number.
$\sum \frac 1{2^n}$ is absolutely convergent : all terms are already positive. $1-\frac 12 + \frac 13 - ... $ is not, because after taking the absolute values, this becomes $1+\frac 12 + \frac 13 + ...$, which is the notorious Harmonic series : it does not have a value, and you can look up the divergence of this series.
Absolutely convergent series can be rearranged. Also, note that if we have complex numbers, then an infinite sum is absolutely convergent if the infinite sum of the absolute values, now a sequence of real numbers, is absolutely convergent. For example, $1 + \frac 1{2i} + \frac 1{4i^2} + \frac 1{8i^3} + ...$ is absolutely convergent.
Now, we know that infinite sums aren't all good : but some are good, and some are very good.
Back to the Riemann Zeta function
The Riemann zeta function, assigns to whichever possible complex number, an infinite sum, which uses that complex number as a parameter. More precisely, wherever the sum is absolutely convergent, we define : $$ \zeta(s) = \sum_{n=1}^\infty n^{-s} = \frac 1{1^s} + \frac 1{2^s} + \frac 1{3^s} + ... $$
(Note : in case you are wondering how something like $2^{4+5i}$ is defined i.e. how complex exponentiation is defined, then you can read it up separately, but the idea is using logarithms defined very specially on the complex numbers. You may also know the Euler formula $e^{i\theta} = \cos \theta + i\sin \theta$, and the polar form of a complex number : this is related).
So there are some $s$ where this is absolutely convergent. For example, at $s = 2$, it is absolutely convergent. At $s = 4+5i$, this is absolutely convergent.
In fact, this is absolutely convergent precisely for those complex numbers which satisfy $\Re(s) > 1$ i.e. those whose real parts are greater than $1$.
The values $s$ for which $\Re(s) \leq 1$ are thus left marooned by this definition.
Rescuing the marooned values
The marooned values are rescued by what is called as the concept of analytic continuation. Analytic continuation is the extension of a "smooth" function to a larger domain : so that we can decide what that function should do to values other than those for which it already knows what to do, so that "smoothness" is preserved.
Basically, there are results that allow the extension of a function that is defined on a set, to a larger set in a smooth manner. This is the concept of analytic continuation.
However , analytic continuation only tells us that there exists a function extending the zeta function. It does not tell us, however, what values this function will take on functions outside the domain.(It is like shaking a closed box and concluding that there is something inside, but you don't know what is inside).
So how did we find certain values of $\zeta$?
That is the genius of Riemann, and his functional equation: $$ \zeta(s) = 2^s \pi^{s-1} \sin\left(\frac{\pi s}{2}\right) \Gamma(1-s)\zeta(1-s) $$
(The gamma function $\Gamma$ is actually an extension of "factorial" to the complex plane. It has a definition I won't go into, but more importantly, for $n > 1$ a positive integer, we do have $\Gamma(n) = (n-1)!$).
His functional equation, as you can see, relates values of $\zeta$ at points which are outside $\Re(s) > 1$, to those which are inside $\Re(s) > 1$, with the help of the Gamma function, and the sine function (another which must be extended to the complex plane from the obvious definition it has on the real numbers).
As an exercise, use the values $\zeta(2) = \frac{\pi^2}{6}$ and $\Gamma(2) = 1! = 1$ to find $\zeta(-1)$. Don't be too surprised.
This, combined with the series given by Euler for $\Re(s) > 0$ (this is not absolutely convergent, so there itself the pattern breaks) $$ \zeta(s) = \frac 1{1 - 2^{1-s}} \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n^s} $$
Gives us a complete(read : convoluted, discombobulated,undecipherable but correct) description of the values of the $\zeta$ function on the complex plane.
As you may have noted from the Wiki article, some values of the zeta function are not defined,because $\Gamma$ is not defined at these points. This is why the function is called meromorphic : it takes infinite values at some points. Fortunately, we are ok with working with an object like this.
Conclusion
An infinite sum behaves very differently from a finite sum. But some behave nicely, some very nicely.
The Riemann zeta is not defined by an absolutely convergent series everywhere, but is rather an analytic continuation of this absolutely convergent series to the complex plane, wherein the other values are determined by a different functional equation.
Which means, breaking the heart of at least one person I know, that $1+2+3+... = \frac {-1}{12}$ is a false statement, an incorrect interpretation of the fact that $\zeta(-1) = \frac {-1}{12}$.
Just to add : the functional equation is so difficultly defined that one does not even know where $\zeta$ takes the value zero. Just read up the Riemann hypothesis.
The next time you find a string theorist telling you that he is using the value of $1+2+...$, just send him to this post. All of them, some definitely not knowing it, are sitting over the Riemann zeta domain.