How do we know that this function is multivalued? So I have an integral $$ \int_{0}^{2\pi} \frac{1}{2}\left(e^{e^{ix}} + e^{e^{-ix}}\right) \text{ d}x$$
I am told that I am able to substitute $z=e^{ix}$ into this and convert it into a contour integral. This integral would have a pole at $0$, and a branch cut about the negative real number line, and we would make a counterclockwise keyhole contour about the unit circle to solve this.
When I directly look at what Mathematica says as the integral's indefinite antiderivative $$\frac{-i\operatorname{Ei}(e^{ix})+i\operatorname{Ei}(e^{-ix})}{2}+C$$ I can see where some of these come from. $\operatorname{Ei}(z)$ is undefined at $z=0$, which gives us a pole at $0$. $\operatorname{Ei}(z)$ also approaches $0$ as we approach complex infinity, giving us a pole at complex infinity.
Furthermore, despite both $\operatorname{Ei}(x)$ and $e^{ix}$ not being multivalued, for complex $z$, $\operatorname{Ei}(z)$ is indeed multivalued. Since $z=e^{ix}$ will never be $0$, our contour will not hit the pole as well.
However, this raises a few questions. First off, how do we know all of this by just looking at the original integrand $\frac{1}{2}\left(e^{e^{ix}} + e^{e^{-ix}}\right)$? When we are presented with the integral, we don't know it's indefinite antiderivative, so how would we know what its poles are and if it is multivalued or not? For all I know, $e^z$ is always single valued.
Moreover, why is the branch cut along the negative real axis? The poles are 0 and complex infinity. Why is the contour from 0 to negative real infinity instead?

First of all there is no Multivalued function here so
you are talking about branch point and branch that will
help you in only case of multivalued functions
this is a simple integral

$\displaystyle \int_{0}^{2\pi}\frac{1}{2}\left(e^{e^{\iota\theta}}+e^{e^{-\iota\theta}}\right)d\theta$
To solve this integral you have to put $e^{\iota\theta}=z $ which will give give you
a unit circle now you have simple closed contour you can integrate easly
using Cauchy's residue theorem
$\displaystyle \int_{0}^{2\pi}\frac{1}{2}\left(e^{e^{\iota\theta}}+e^{e^{-\iota\theta}}\right)d\theta=\oint_{|z|=1}\frac{1}{2}\left(e^z +e^{\frac{1}{z}}\right)dz$

$\displaystyle=\frac{1}{2}\oint_{|z|=1}\exp\left(\frac{1}{z}\right)dz=\pi\iota\textbf{Res}_{z=0}\exp\left(\frac{1}{z}\right)=\iota\pi$
You can do this using antiderivative but you then you have to integrate along the line
