Why does the complex logarithm have different branches? I have a question regarding the complex logarithm which I have studied a long time ago, therefore not everything is clear anymore.
If I remember it correctly then the general complex logarithm is defined to be the solution of $e^{w}=z$. So I mean then in this case if we write $z=re^{i\theta}$ we say that $$w=\log(r)+i(\theta+2\pi k)$$for all $k\in \Bbb{N}$. Did I understand this correctly?
Now I also know that we define the natural branch of logarithm as $$\log:\Bbb{C}\rightarrow \Bbb{C}\setminus (-\infty,0]$$ where $\log(re^{i\theta})=\log(r)+i\theta$ where $\theta\in [-\pi, \pi)$. First, I don’t see how we get from the general definition to this one with natural branch.  And in addition, why do we here take out the negative real axis? Is this because for example $-1$ the definition would not make sense since $$\log(-1e^{i-\pi})=log(-1)+(-\pi i)$$ and this means $-\pi i=0$?
What is the detailed explanation?
 A: $\def\Log{\operatorname{Log}}$$\def\arg{\operatorname{arg}}$$\def\cbf{\mathbf{C}}$$\def\zbf{\mathbf{Z}}$$\def\rbf{\mathbf{R}}$The complex logarithm.
The complex logarithm is a multi-valued function, which can be formally written as
$$
\log(z) = \{w\in\cbf:e^w=z\}\;\tag{1}
$$
When $z$ is nonzero, it can be written as
$$
\log(z) = \ln|z|+i\arg(z)
$$
where $\arg(z):=\{\theta\in\rbf:\cos\theta+i\sin\theta=\frac{z}{|z|}\}$. Here we use $\ln$ for the natural logarithm of positive real numbers.
So, for instance,
$$
\log(2i)=\{\ln 2+\frac{\pi i}{2}+2k\pi i: k\in\zbf\}\;.
$$
The complex exponential never vanishes, so by our definition (1), $\log(0)$ is the empty set. This is usually why people omit the origin from the domain $\mathbf{C}$ when discussing complex logarithm.
Branches?
Let $U$ be a non-empty open subset of $\cbf\setminus\{0\}$. A function $f:U\to\cbf$ is called a branch of the complex logarithm, if $f(z)\in \log(z)$ for every $z\in U$. It other words, for each $z\in U$, the branch $f$ picks a value $f(z)$ in the set $\log(z)$.
There are many choices of branches for the complex logarithm. We are interested in those have good properties such as homomorphicity (analyticity).
It turns out that if $U=\cbf\setminus\{0\}$, then there is no branch $f:U\to \cbf$ of $\log$ that is holomorphic (in $U$). In other words, no matter how you pick the value $f(z)$ for each $z\in U$, the function $f$ will never be holomorphic on all of $U$.
On the other hand, if $U$ is a simply connected open subset of $\cbf\setminus\{0\}$, we can define a branch $f:U\to\cbf$ that is holomorphic (on all of $U$). For instance the region $U=\cbf\setminus (-\infty,0]$ formed by excluding the negative real axis from the complex plane is simply connected and so must admit a holomorphic branch of the complex logarithm. One such branch is the standard branch $\Log:\cbf\setminus (-\infty,0]\to\cbf$, defined as
$$
\Log(z):=\ln|z|+i\operatorname{Arg}(z)\tag{2}
$$
where $\operatorname{Arg}(z)$ is the standard branch of the argument, defined as the unique argument in $\arg(z)$ in the interval $(-\pi,\pi)$.
Examples.

... why do we here take out the negative real axis?

We don't have to, this is just one way to get a simply connected open subset of the punctured complex plane $\cbf\setminus\{0\}$. But we have to take out something in order to get a holomorphic branch.
[Edited.] There are many other ways to get holomorphic branches of the logarithm.
You can pick another branch of the $\arg(z)$ in (2). For instance, define for $z\in\cbf\setminus(-\infty,0]$,
$$
f(z)=\ln|z|+i\theta
$$
where $\theta$ is the unique argument in $\arg(z)$ in the interval $(3\pi,5\pi]$.
Then in this branch, you have
$$
f(1+i)=\ln(\sqrt{2})+i(4\pi+\frac{\pi}{4})\;,
$$
while in the standard branch, you have
$$
\Log(1+i)=\ln(\sqrt{2})+i(\frac{\pi}{4})\;.
$$
Or you can change the domain $\cbf\setminus (-\infty,0]$ to some other simply connected open subset of $\cbf\setminus \{0\}$, e.g., $U=\cbf\setminus [0,+\infty)$, and then choose a branch of the argument function.
For instance, let $f:\cbf\setminus [0,+\infty)\to\cbf$ be
$$
f(z)=\ln|z|+i\theta\tag{3}
$$
where $\theta$ is the unique argument in $\arg(z)$ in the interval $(0,2\pi)$.
A: Yes, $w\in\Bbb C$ is a logarithm of $z\in\Bbb C$ if $e^w=z$. And, yes, if $z=re^{i\theta}$ and $w$ is a logarithm of $z$, then $w=\log(r)+i(\theta+2k\pi)$, for some $k\in\Bbb Z$.
Usually, if we can work only with complex numbers $z\in\Bbb C\setminus(-\infty,0]$, we work with the main logarithm $\log\colon\Bbb C\setminus(-\infty,0]\longrightarrow\Bbb C$ which is such that $\log(re^{i\theta})=\log(r)+i\theta$ (assuming that $\theta\in(-\pi,\pi)$). Note that $\log(r)+i\theta$ is a logarithm of $z$ and that it is the simplest one. That makes it a natural choice.
So, why don't we extend this to a map from $\Bbb C\setminus\{0\}$ into $\Bbb C$? We could do it if we mapped $re^{i\theta}$ ($\theta\in[-\pi,\pi)$) into $\log(r)+i\theta$. Problem: this would not be a continuous function anymore. And there is nothing wrong with the interval $[-\pi,\pi)$; if we had used the interval $(-\pi,\pi]$, we would have the same problem.
More generally, there is no continuous function $l\colon\Bbb C\setminus\{0\}\longrightarrow\Bbb C$ such that, for every $z\in\Bbb C\setminus\{0\}$, $l(z)$ is a logarithm of $z$.
