An estimate on number of solutions $e^z=a$ in $|z|\leq r.$ Let $n(r,a)$ be the number of solutions of $e^z=a$ in $|z|\leq r, $ where $a\in\mathbb{C}\setminus\left\{0\right\}.$
I have to estimate this number.
Attempt: Writing $a=|a|e^{i\theta}.$ Then $e^{z}=a$ gives $$z=\log|a| + i\left(\theta + 2k\pi\right),$$ where $k\in\mathbb{Z}.$
For these solutions to lie inside $|z|\leq r,$ we must  have
$$|\log|a| + i\left(\theta + 2k\pi\right)|\leq r$$ which means that $$(\log|a|)^2 + (\theta + 2k\pi)^2\leq r^2$$
This finally gives $$k\leq\frac{\sqrt{r^2-(\log|a|)^2}}{2\pi}-\theta/2\pi.$$
It has been proved that $$n(r,a)=\frac{\sqrt{r^2-(\log|a|)^2}}{\pi} + O(1).$$ However, I am unable to understand how to arrive at this estimate.

Your calculation is correct up to
$$
(\log|a|)^2 + (\theta + 2k\pi)^2\leq r^2 \, .
$$
That is equivalent to
$$
 |\theta + 2k\pi| \le \sqrt{r^2 - (\log|a|)^2} \\
\iff - \sqrt{r^2 - (\log|a|)^2} \le \theta + 2k\pi \le \sqrt{r^2 - (\log|a|)^2} \\
\iff - \frac{\sqrt{r^2 - (\log|a|)^2}}{2 \pi} - \frac{\theta}{2 \pi}
\le k \le \frac{\sqrt{r^2 - (\log|a|)^2}}{2 \pi} - \frac{\theta}{2 \pi} \, .
$$
So $k$ lies in an interval of length $\frac{\sqrt{r^2 - (\log|a|)^2}}{\pi}$. It follows that
$$
\frac{\sqrt{r^2 - (\log|a|)^2}}{\pi} \le n(r, a) \le \frac{\sqrt{r^2 - (\log|a|)^2}}{\pi} + 1 
$$
because a closed interval of length $L$ contains between $L$ and $L+1$ integral points.
