In the following, we (mostly directly) describe results outlined in "Differential Equations with Applications and Historical Notes (3ed)" by George F. Simmons (Pages 74 to 77 and Pages 8-9).
$\textbf{Claim 1}$: The equation
\begin{align}\label{eqn::1}\tag{1}
B(x,y) dx + A(x,y) dy = 0
\end{align}
always has an integrating factor if it has a general solution (to be defined later) $f(x,y) = \xi$ for some scalar $\xi.$
$\textit{Proof}$. Suppose that (\ref{eqn::1}) has the general solution
\begin{align}\label{eqn::2}\tag{2}
f(x,y) = \xi
\end{align}
for some $\xi \in \mathbb{R}.$
Then one may compute the total derivative of $f,$ which eliminates $\xi,$ and yields
\begin{align}\label{eqn::3}\tag{3}
df = \frac{\partial f}{\partial x} dx + \frac{\partial f}{\partial y} dy = 0.
\end{align}
By (\ref{eqn::1}) and (\ref{eqn::3}), one has
\begin{align}\label{eqn::4}\tag{4}
\frac{dy}{dx} = - \frac{B(x,y)}{A(x,y)} = - \frac{\frac{\partial f}{\partial x}}{\frac{\partial f}{\partial y}}.
\end{align}
Therefore,
\begin{align}\label{eqn::5}\tag{5}
\frac{\frac{\partial f}{\partial x}}{B(x,y)} = \frac{\frac{\partial f}{\partial y}}{A(x,y)}
\end{align}
Set $\mu(x,y) = \frac{\frac{\partial f}{\partial x}}{B(x,y)} = \frac{\frac{\partial f}{\partial y}}{A(x,y)}.$ This implies that $\frac{\partial f}{\partial x} = \mu(x,y) B(x,y)$ and $\frac{\partial f}{\partial y} = \mu(x,y) A(x,y).$ Hence, multiplying (\ref{eqn::1}) by $\mu(x,y)$ yields
\begin{align}\label{eqn::6}\tag{6}
\mu(x,y) B(x,y) dx + \mu(x,y) A(x,y) dy = 0
\end{align}
or, equivalently
\begin{align}\label{eqn::7}\tag{7}
\frac{\partial f}{\partial x} dx + \frac{\partial f}{\partial y} dy = 0,
\end{align}
which is exact. Thus, if (\ref{eqn::1}) has a general solution, then it has at least one integrating factor. In fact, (\ref{eqn::1}) as arbitrarily many integrating factors in this case. Observe that for any mapping $T(f)$ of $f,$ one has
\begin{align}\label{eqn::8}\tag{8}
\mu(x,y) T (f) (B(x,y) dx + A(x,y) dy) &= T(f) ( \mu(x,y) B(x,y) dx + \mu(x,y) A(x,y) dy )\\
&= T(f) df \\
&= d \left[ \int T(f) df \right],
\end{align}
in which case, $\mu(x,y) T(f)$ is also an integrating factor for (\ref{eqn::1}).
Also note the following: if $\mu$ is an integrating factor for (\ref{eqn::1}), then, by the exactness of (\ref{eqn::6}), we have (suppressing the arguments of the functions for convenience)
\begin{align}\label{eqn::9}\tag{9}
\frac{\partial (\mu B)}{\partial y} = \frac{\partial (\mu A)}{\partial x} &\iff \mu \frac{\partial B}{\partial y} + M \frac{\partial \mu}{\partial y} = \mu \frac{\partial A}{\partial x} + A \frac{\partial \mu}{\partial x} \\
&\iff \frac{1}{\mu} \left[ A \frac{\partial \mu}{\partial x} - B \frac{\partial \mu}{\partial y} \right] = \frac{\partial B}{\partial y} - \frac{\partial A}{\partial x}.
\end{align}
$\textbf{Claim 2}$:
(i) If $\mu(x,y) \equiv \mu(x),$ then there exists some function $L(x)$ such that $\mu(x) = e^{\int L(x) dx}.$
(ii) If $\frac{\frac{\partial B}{\partial y} - \frac{\partial A}{\partial x}}{A(x,y)} = H(x),$ then there exists a function of $x,$ say $\hat{\mu}(x),$ such that $\hat{\mu}$ is an integrating factor for (\ref{eqn::1}). (simply define $\hat{\mu}(x) = e^{\int H(x) dx}$ and check that it obeys the aforementioned requirements for an integrating factor).
$\textit{Proof of}$ (i). Suppose that $\mu(x,y) \equiv \mu(x).$ Then (\ref{eqn::9}) yields
\begin{align}\label{eqn::10}\tag{10}
\frac{1}{\mu} \frac{\partial \mu}{\partial x} = \frac{\frac{\partial B}{\partial y} - \frac{\partial A}{\partial x}}{A(x,y)}.
\end{align}
Set $L(x) = \frac{\frac{\partial B}{\partial y} - \frac{\partial A}{\partial x}}{A(x,y)}.$ Then we have
\begin{align}\label{eqn::11}\tag{11}
\frac{1}{\mu} \frac{\partial \mu}{\partial x} = L(x) &\iff \frac{d (\log \, \mu)}{dx} = L(x) \\
&\iff \log \, \mu = \int L(x) \, dx \\
&\iff \mu = e^{\int L(x) \, dx}.
\end{align}
Note that this line of logic can be done in the opposite direction to yield (ii). That is, assume (ii), then $\hat{\mu}(x) = e^{\int H(x) dx}$ depends only on $x$ and also satisfies (\ref{eqn::9}).
$\textbf{What is a General Solution}$?
- Theorem (Banach-Picard): If $f(x,y)$ and $\partial f / \partial y$ are continuous functions on a closed rectangle $R,$ then for every point $(a,b) \in \textrm{int} \, R,$ there passes a unique integral curve of the equation $dy / dx = f(x,y).$
If one fixes $a$ in the context of the theorem above, then the integral curve passing through $(a,b)$ is a one-parameter family of curves, parametrized by $b;$ i.e., it is a family of functions of the form $\{ y_{\alpha}(x) \}_{\alpha \in I}$ (here, $I$ is a (possibly uncountable) indexing set dictating the space of the parameters; in our case $I = \mathbb{R}$).
Thus, the integral curve that passes through the point $(a,b)$ corresponds to some value $\alpha$ for which $b = y_{\alpha}(a).$ If we denote this critical $\alpha$ by $\alpha_0,$ then
$$ y(x) = y_{\alpha}(x) $$
is called the general solution of $dy / dx = f(x,y)$ and
$$ y(x) = y_{\alpha_0}(x) $$
is called the particular solution of $dy / dx = f(x,y).$
A more thorough description of results for differential equations of this type can be found in "Differential Calculus" by Henri Cartan (Section 3.10., Pages 144 to 147).