This may be to your surprise. In certain settings, the statement
$$S = \sum_{k=0}^\infty 2^k = 1 + 2 + 2^2 + 2^3 + \cdots = -1$$
is true and the manipulation
$$S = 1 + 2S \quad\implies\quad S = -1$$
is actually legal! The catch is the convergence of the series is not the ordinary one over real numbers!
To understand this, we need to step back and ask what the real numbers $\mathbb{R}$ are.
One way to construct $\mathbb{R}$ is start from the rational numbers $\mathbb{Q}$. On $\mathbb{Q}$, we have the ordinary absolute value $|x|$. Using this absolute value, we can turn $\mathbb{Q}$ into
a metric space by defining the usual Euclidean distance:
$$d(x,y) \stackrel{def}{=} |x-y|,\quad \forall x,y \in \mathbb{Q}$$
When $\mathbb{Q}$ is endorsed with the Euclidean metric $d(\cdot,\cdot)$, we can talk about Cauchy sequences over $\mathbb{Q}$.
A sequence $(a_i)$ over $\mathbb{Q}$ is Cauchy if for any $\epsilon > 0$, we can find
an integer $N$ such that $d(a_i,a_j) < \epsilon$ whenever $i, j \ge N$.
We can setup equivalence relations among these Cauchy sequences:
Two Cauchy sequences $(a_i)$, $(b_i)$ are equivalent if and only if $d(a_i,b_i) \to 0$ as $i \to \infty$.
We can define addition, multiplication and other operations on these equivalence classes of
Cauchy sequences over $\mathbb{Q}$. It turns out these collections of equivalence classes give you something behaves exactly like the familiar real numbers $\mathbb{R}$.
In certain sense, we can construct $\mathbb{R}$ by filling the holes among elements of $\mathbb{Q}$ and the holes are measured with respect to the Euclidean metric $d(\cdot,\cdot)$. For more details along this line, look up wiki's entry
on Construction of real numbers.
The important point is there are more than one way to assign "absolute value" to rational numbers. In particular, given any prime $p$ we can define something called p-adic valuation for integer $n \in \mathbb{Z}$
and then extend it to rational numbers $\frac{a}{b} \in \mathbb{Q}$:
$$v_p(n) = \begin{cases}
\max\{ v \in \mathbb{N} : p^v | n \},& \text{ if } n \ne 0\\
\infty,&\text{ if } n = 0
\end{cases}
\quad\text{ and }\quad
v_p\left(\frac{a}{b}\right) = v_p(a) - v_p(b)
$$
Using this, we can define an alternate absolute value, the p-adic norm for the rational numbers $\mathbb{Q}$:
$$\mathbb{Q} \ni x \quad\mapsto\quad |x|_p =
\begin{cases}
p^{-v_p(x)},& \text{ if } x \ne 0\\
0,& \text{ if } x = 0
\end{cases}$$
If you repeat the above procedure for $\mathbb{R}$, you can fill in the holes measured with respect to the p-adic norm $|x|_p$ and get something called the
p-adic numbers $\mathbb{Q}_p$.
Similar to $\mathbb{R}$, $\mathbb{Q}_p$ is a complete metric space. You can talk about sequences, series, convergence and do all sort of analysis over $\mathbb{Q}$.
For example, for any prime $p$, following geometric series converges
$$\sum_{k=0}^\infty p^k = 1 + p + p^2 + \cdots
\quad\to\quad \frac{1}{1-p} \quad\text{ in }\; \mathbb{Q_p}$$
because $|p|_p = \frac{1}{p} < 1$.
In particular, when $p = 2$, we have
$$S = \sum_{k=0}^\infty 2^k = 1 + 2 + 2^2 + \cdots
\quad\to\quad = \frac{1}{1-2} = -1 \quad\text{ in }\; \mathbb{Q_2}$$
The proof is exactly the same as what you will do over real numbers:
$$\sum_{k=0}^\infty x^k = \frac{1}{1-x}\quad\text{ for }\; |x| < 1\;\text{ in }\;\mathbb{R}$$
In short,
- The sum is $-1$ when you are working with numbers in $\mathbb{Q}_2$.
- The sum is $\infty \not\in \mathbb{R}$ when you are working with numbers in $\mathbb{R}$.
- Over $\mathbb{Q}_2$, the manipulation
$$S = 1 + 2S \quad\implies\quad S = -1$$
is legal because the series $S$ converges absolutely. The same manipulation is illegal over $\mathbb{R}$ because the series $S$ diverges with respect to the Euclidean metric.
- Finally, $\infty \ne -1$ because $\mathbb{Q}_2 \ne \mathbb{R}$.
Advice
People like to throw out this sort of statements just to confuse you.
They are only mind boggling if one ignore the true meanings behind the symbols.