How to find the value of Grandi's series using Ramanujan's summation I can't figure out how to solve the infinite sum of

$\sum ^{\infty }_{n=0}\left[( -1)^{n}\right]$

I know that Srinivasa Ramanujan solved it and I couldn't figure it out with Ramanujan's summation. Here's what I tried.

Note: I'm only interested in solving this divergent sum by means of Ramanujan's summation. I know about the other methods, but am unable to solve it with Ramanujan's summation. So here's what I tried

$ \begin{array}{l}
\sum ^{\infty }_{n=1}\left[( -1)^{n}\right]\overset{\Re }{=} -\frac{1}{2} +i\int\limits ^{\infty }_{0}\frac{e^{-\pi x} -e^{\pi x}}{e^{2\pi x} -1} dx=-\frac{1}{2} -i\int\limits ^{\infty }_{0}\frac{e^{-\pi x}\left( e^{2\pi x} -1\right)}{e^{2\pi x} -1} dx=-\frac{1}{2} -\frac{i}{\pi }\\
\Longrightarrow \\
\sum ^{\infty }_{n=0}\left[( -1)^{n}\right] =1-\frac{1}{2} -\frac{i}{\pi } =\frac{1}{2} -\frac{i}{\pi }
\end{array}$

Which is obviously wrong.

Here are some ideas that were tried though

$\sum ^{\infty }_{n=0}\left[( -1)^{n}\right]$ Has no imaginary part--therefore

$\sum ^{\infty }_{n=0}\left[( -1)^{n}\right] =\frac{1}{2}$

The other idea is

$ \begin{array}{l}
\sum\limits ^{\infty }_{n=1} f( n)\overset{\Re }{=} -\frac{f( 0)}{2} +i\int\limits ^{\infty }_{0}\frac{f( ix) -f( -ix)}{e^{2\pi x} -1} dx\\
\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mathfrak{Grandi's\ series}\\
\sum ^{\infty }_{n=0}( -1)^{n} =1+\sum\limits ^{\infty }_{n=1}( -1)^{n}\overset{\Re }{=}\\
1-\frac{1}{2} +i\int\limits ^{\infty }_{0}\frac{( -1)^{ix} -( -1)^{-ix}}{e^{2\pi x} -1} dx=\frac{1}{2} +i\int\limits ^{\infty }_{0}\frac{( -1)^{ix} -( -1)^{-ix}}{e^{2\pi x} -1} dx\\
\ ( -1)^{a} =( -1)^{-a} \Longrightarrow \\
\frac{1}{2} +i\int\limits ^{\infty }_{0}\frac{( -1)^{ix} -( -1)^{ix}}{e^{2\pi x} -1} dx=\frac{1}{2} +i\int\limits ^{\infty }_{0} 0dx=\frac{1}{2} \Re 
\end{array}$

But this shouldn't work because the thing $( -1)^{a} =( -1)^{-a} ,\ a\in \mathbb{Z}$

And $x$ is not an integer , Right? Well, I can't figure this out. Any help is appreciated! Thanks!

Edit:

Actually, I realize that Srinivasa Ramanujan probably did it using the derichlet eta function$\Longrightarrow$

$ \begin{array}{l}
\sum ^{\infty }_{n=0}( -1)^{n} =1+\sum ^{\infty }_{n=1}( -1)^{n} =1-\eta ( 0) ,\ \eta ( 0) =-\zeta ( 0) =\frac{1}{2}\\
\boxed{\therefore \sum ^{\infty }_{n=0}( -1)^{n} =\frac{1}{2}}
\end{array}$
$S = \sum ^{\infty }_{n=0}\left[( -1)^{n}\right] = 1 -\sum ^{\infty }_{n=0}\left[( -1)^{n}\right]=1-S$ and so we have $S=1-S \implies S = \frac{1}{2}$.
Instead of writing the terms as $f(n)=(-1)^n$ try using just the real part $f(n)=\cos(\pi n)$.
Edit: Let me elaborate.  Ramanujan uses the Euler–Maclaurin formula in the form
$$ \sum_{m=1}^n f(m) \sim c + \int_a^n f(x)\,dx+\tfrac{1}{2}f(n)+\sum_{r=1}^\infty \frac{B_{2r}}{(2r)!}f^{(2r-1)}(n) $$
but if you set $f(n)=(-1)^n$ then the infinite series on the right is purely imaginary while the finite sum on the left is purely real—that is why the constant $c$ that you obtained had an imaginary component.  This problem is circumvented if you choose $f$ to be purely real rather than a complex-valued function.