Disclaimer: I am not a mathematician, I am a physicist.
The thermodynamic identity is usually expressed in the following differential form
$$ dU = TdS - PdV + \mu dN, $$
where $U$, $T$, $S$, $P$, $V$, $\mu$ and $N$ are the internal energy, temperature, entropy, pressure, volume, chemical potential and number of particles of the system respectively. If I am not mistaken, I can act with a vector, say $\frac{\partial}{\partial N}$, to yield
$$ \frac{\partial U}{\partial N} = T \frac{\partial S}{\partial N} - P \frac{\partial V}{\partial N} + \mu \implies \mu = \frac{\partial U}{\partial N} - T \frac{\partial S}{\partial N} + P \frac{\partial V}{\partial N}. $$
Consider the following question:
Consider a monoatomic ideal gas that lives at height $z$ above sea level, so each molecule has potential energy $mgz$ in addition to its kinetic energy. Show that the chemical potential $\mu$ is the same as if the gas were at sea level, plus am additional term $mgz$:
$$ \mu(z) = -k_b T \text{ln}\left[\frac{V}{N}\left(\frac{2\pi m k_bT}{h^2}\right)^{3/2}\right] + mgz. $$
My attempt was knowing that:
The "ideal monoatomic gas" implies $U = \frac{3}{2}k_bT$ (by equipartition theorem) and the validity of Sackur-Tetrode equation:
$$ S=k_bN\ln \left[{\frac {V}{N}}\left({\frac {4\pi m}{3h^{2}}}{\frac {U}{N}}\right)^{3/2}\right]+{\frac {5}{2}}, $$
together with the assumption that $V \neq V(N)$. If one uses the above formula for $\mu$ and takes the partial derivatives I yield
$$ \mu(z) = -k_b T \text{ln}\left[\frac{V}{N}\left(\frac{2\pi m k_bT}{h^2}\right)^{3/2}-\frac{3}{2}\right] + mgz, $$
which is almost correct except for that $-\frac{3}{2}$, although it still exhibits the problems described below.
I came to the conclusion that I don't know how to manipulate these equations in differential form, am I allowed to do the above "act with $\frac{\partial}{\partial N}$" business? The solution provided by the book is to say, hey hold $U$ and $V$ fixed so that the thermodynamic identity now reads
$$ 0 = TdS - 0 + \mu dN \implies \mu = T \left(\frac{\partial S}{\partial N}\right)_{V,U \text{ fixed}} $$
but $U = U(N)$, in particular $U = \frac{3}{2} k_b N T$ I could litterally make all the $N$s in $S$ dissapear by substituting $N = \frac{2 U}{3 k_b T}$ and claim that
$$ \mu = T \left(\frac{\partial S}{\partial N}\right)_{V,U \text{ fixed}} = 0, $$
which is ridiculous. I'm really lost with the mathematics behind this type of calculations... Which would be the correct way to proceed?
The problem with your approach is that this differential form is living not in $6$-dimensional space (with coordinates $T,S,p,V,\mu,N$), but rather along some constraint submanifold (given by your thermodynamic constraints). The vector field $\partial/\partial N$ is most likely not tangent to that constraint submanifold, and so varying $N$ entails varying other variables. (This is why thermodynamics is so careful about using the subscript notation to indicate which variables are held fixed when one writes a partial derivative.)
I would like to see the complete solution from the book, not your editorializing on it. You keep writing $U=U(N)$ (and $V\ne V(N)$), which is just wrong. $U$ is never a function of $N$ alone, unless you're fixing other variables. (Even though I studied thermodynamics in college and did very well at it, that was almost 50 years ago, so my knowledge is rusty. I do not recall the equipartition theorem and never knew the Sackur-Tetrode equation.)