By choosing the branch cut to be the line $\gamma=\{it\in \Bbb C: t\le 0\}$, we can write the complex logarithm as $$\text{Log}(z) = \log(|z|) + i\arg(z),$$ where $\arg(z) \in (-\pi,\pi].$ As a function of $x$ and $y$ (in $z=x+iy)$, we write $$ \arg(z) = \arctan\left(\frac yx\right). $$
How do we rigorously justify the following equalities $$\begin{align} \partial_x \left(\arctan\left(\frac yx\right)\right) &= \frac{-y}{x^2+y^2}, \\ \partial_y \left(\arctan\left(\frac yx\right)\right) &= \frac{x}{x^2+y^2}? \end{align}$$
I usually see the above expressions come up when one want to show that the Cauchy-Riemann equations holds for $f(z) = \text{Log}(z)$. We can blindly apply the chain rule the get the answer but that is not rigorous because for $x=0$ the fraction $\frac yx$ is undefined.
To make it rigorous, we can rather write $\arg(z) = A(x,y)$ where $$ A(x,y) = \begin{cases} \arctan\left(\frac yx\right) &; x\ne 0 \\ \pi/2 &;x=0, y>0 \\ -\pi/2 &; x=0, y<0 \end{cases} $$ and compute the derivatives of this function carefully case by case instead but I find this method to be troublesome. Is there a neat way to get the result without having to consider $x=0$ as a separated case?
If you mean to differentiate $$ \arg(z)=i(\log|z|-\log z) $$ then it is quite straightforward, e.g. with respect to $x$ $$ \frac{\partial}{\partial x}\arg(z)=i\left(\frac{1}{|z|}\cdot \frac{x}{|z|}-\frac{1}{z}\right)=i\left(\frac{x}{|z|^2}-\frac{\bar z}{|z|^2}\right)=\frac{-y}{|z|^2}. $$ Similarly w.r.t. $y$, the only difference is $|z|_y'=\frac{y}{|z|}$ and the extra $i$ when differentiate $\log z$ $$ \frac{\partial}{\partial y}\arg(z)=i\left(\frac{1}{|z|}\cdot \frac{y}{|z|}-\frac{1}{z}\cdot i\right)=\frac{x}{|z|^2}. $$