How to find the solution for $n=2$? Let $f: \mathbb R^n \setminus \{0\} \to \mathbb R^n \setminus \{0\}$ be a function only depending on the distance from the origin, $f = f(r)$, where $r = \sqrt{\sum_{i=1}^n x_i^2}$. 
I calculated 
$$ \Delta f = {n-1\over r}f_r + f_{rr}$$
and I am trying to determine which $f$ satisfy
$${n-1\over r}f_r + f_{rr}=0$$
I integrated and found that 
$$ f(r) = K' r^{2-n} + K''$$
satisfies this equation. 
My problem is: I know that for $n=2$ the logarithm satisfies this equation too. But I don't know how to deduce it from what I've done so far.

You're not showing your detailed reasoning, but I imagine the penultimate step must have been
$$ f'(r) = K_0 r^{1-n} $$
from which you get by indefinite integration
$$ f(r) = \frac{K_0}{2-n} r^{2-n} + K_1 $$
When $n\ne 2$, the division by $2-n$ can be absorbed into the arbitrary constant, but for $n=2$ you end up dividing by zero and everything blows up. Therefore you need a special case for integrating $r^{-1}$ and we get
$$ f(r) = K_0 \log r + K_1 $$
The rule $\int x^k\,dx = \frac{1}{k+1}x^{k+1} + K$ works only under the condition that $k+1\ne 0$.
The logarithm that arises in the $k=-1$ case may seem to be a strange discontinuity, but actually it's a nice pointwise limit of the other indefinite integrals, if only we select appropriate constants of integration:
$$ \log x = \lim_{k\to -1} \left[\frac{x^{k+1}}{k+1}-\frac{1}{k+1}\right] $$
It only looks like an isolated case because for all other exponents we can choose the antiderivative such that its value at either $0$ or $+\infty$ is $0$ -- but that option isn't available for the logarithm.
