Let $M(x,y)$ and $N(x,y)$ be continuous functions with continuous first partial derivatives. Then $M(x,y)dx+N(x,y)dy$ is exact if and only if $\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}$.
I am trying to prove the sufficient direction, assuming $\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}$. The proof says you can either let $\frac{\partial f}{\partial x}=M(x,y)$ or $\frac{\partial f}{\partial y}=N(x,y)$. I will let $\frac{\partial f}{\partial x}=M(x,y)$.
Integrating both sides with respect to $x$ gives $f(x,y)=\int M(x,y)dx + g(y)$, where $g(y)$ is the constant of integration.
Differentiating both sides with respect to $y$ gives $\frac{\partial f}{\partial y}=\frac{\partial}{\partial y}\int M(x,y)dx + g'(y)$.
My question might seem elementary (I just started learning ODE and my multivariable knowledge is a little rusty): Why is $N(x,y)$ equal to $\frac{\partial}{\partial y}\int M(x,y)dx + g'(y)$?
You really need to be more specific about your integrals. Say we're working on a rectangle containing the origin. You set $$f(x,y) = \int_0^x M(t,y)\,dt + g(y)$$ for some unknown function $g(y)$. Now you differentiate under the integral sign and get $$\frac{\partial f}{\partial y} = \int_0^x \frac{\partial M}{\partial y}(t,y)dt + g'(y) = \int_0^x \frac{\partial N}{\partial x}(t,y)\,dt + g'(y) = N(x,y) - N(0,y) + g'(y).$$ You now see that by choosing your $g(y) = \int_0^y N(0,u)\,du$, you get what you want.