When attempting to find an integrating factor to turn an almost-exact differential equation into an exact differential equation, we multiply through by an integrating factor $\mu (x, y)$:
$\mu (x, y) M(x, y) \ dx + \mu(x, y) N(x, y) \ dy = 0$.
We must then find a function of $\mu$ so that
$\dfrac{\partial}{\partial{y}}\left[ \mu \left( M(x,y) \right) \right] = \dfrac{\partial}{\partial{x}}\left[ \mu \left( N(x,y) \right) \right]$.
And then the DE will be exact.
After using the product rule on the above PDE, depending on which makes mathematical sense for our purpose, we assume that $\mu$ is only a function of either $y$ or $x$. This then allows us to find the integrating factor that will make the DE exact.
But how does this make sense? We first said that the integrating factor $\mu$ is a function of $x$ and $y$. But then afterwards, we assumed that $\mu$ was a function of either $x$ or $y$, depending on which one makes mathematical sense for the specific case.
I would greatly appreciate it if people could please take the time to clarify this.
The methodology is elaborated upon here.
Your goal is just to find a particular function $\mu(x,y)$ such that
$$\mu (x, y) M(x, y) \ dx + \mu(x, y) N(x, y) \ dy = 0$$
In particular if you find that your $\mu(x,y)=\mu_1(x)$, it is also a valid integrating factor, just that now we know more information that the function is independent of $y$ and it makes computation simpler. In particular if we have to differentuate the function with respect to $y$, the term vanishes.