Exact equation
An ODE $P(x,y) \,dx + Q(x,y)\,dy = 0$ is exact if there exists $f(x,y)$ such that
$$ df = P(x,y)\,dx + Q(x,y)\,dy. $$
Then $df=0$ so $f(x,y) =$ constant is the solution.
Therefore we need to find $f$ such that
$$\begin{cases}
\frac{\partial f}{\partial x} = P(x,y), \\
\frac{\partial f}{\partial y} = Q(x,y).
\end{cases}$$
Check this condition in your head:
Note that $\frac{\partial^2 f}{\partial x\partial y} = \frac{\partial^2 f}{\partial y\partial x}$, so a necessary condition for an exact equation is
$$ \frac{\partial P}{\partial y} = \frac{\partial Q}{\partial x}. $$
The theorem below says this is a sufficient condition under certain domains.
Theorem (sufficient condition for exact differential in simply-connected domain)
open_in_new
If $$\begin{align*}
\frac{\partial P}{\partial y} = \frac{\partial Q}{\partial x}
\end{align*}$$
throughout a simply connected domain $\mathcal D$, then
$P\,dx + Q\,dy$ is an exact differential of single-valued $f(x,y)$ in $\mathcal D$.
Example of exact equation