I have defined a function $f : \mathbb{R}^2 \setminus \{ (x,0) \mid x \leq 0 \} \to (-\pi, \pi)$ as the $\mathrm{atan}2$ function from this Wikipedia article https://en.wikipedia.org/wiki/Polar_coordinate_system#Converting_between_polar_and_Cartesian_coordinates . In other words, my function $f$ gives me the argument if I interpret $(x,y)$ in terms of polar coordinates.
I claim $f$ is $C^\infty$. Indeed, since $\frac{\partial}{\partial x} \arctan(y/x) = \frac{-y}{x^2+y^2}$ and $\frac{\partial}{\partial y} \arctan(y/x) = \frac{x}{x^2+y^2}$, all the partial derivatives of $f$ exist and are continuous on the domain.
Q1 Since I'm dealing with a piecewise function, do I need to check anything else? I guess I'm not quite sure what I mean by partial derivative of $f$? Can I just say that this is the partial derivatives of each part of the piecewise definition? In that case, I guess for it to be continuous I need to check that the limits going from one piecewise thing to another agree?
Note that $f$ does not extend continuously to $\mathbb{R}^2 \setminus 0$ because the limits approaching from above and below the cut of the original domain do not agree.
Finally, I would like to take the gradient $\nabla f(x,y)$.
Q2 Is my understanding correct that the gradient of my piecewise function $f$ will be the gradient of each piece of the piecewise thing?
If this is the case, then $\nabla f(x,y) = (\frac{-y}{x^2+y^2}, \frac{x}{x^2+y^2})$ on all of $\mathbb{R}^2 \setminus \{ (x,0) \mid x \leq 0 \}$. But note that this is $C^\infty$ everywhere on $\mathbb{R}^2 \setminus 0$, so I can extend $\nabla f(x,y)$'s domain of definition to $\mathbb{R}^2 \setminus 0$. Let's call the extended vector field $F$.
Q3 Why can $F$ itself not be the gradient vector field of some function? If it were conservative then for any closed curve $\gamma$ in the domain we would have $\int_\gamma F \cdot dz = \int_\gamma \nabla g \cdot dz = 0$. For a counter-example, choose $\gamma$ to be the unit circle given by $x^2+y^2=1$. Note that for such $(x,y)$ we have $F(x,y)=(-y,x)$. So $$ \int_\gamma F \cdot dz = \int_\gamma (-y,x) \cdot (dx, dy) = \int_\gamma -y dy + \int_\gamma x dx $$. But I'm not sure how to evaluate this integral and show that (hopefully) it's non-zero...