How does an integrating factor geometrically "uncurl" a vector field? We know that certain 1-D forms $m(x,y,z)\,dx + n(x,y,z)\,dy + p(x,y,z)\,dz$ admit integrating factors as we teach in basic differential equations. How does the integrating factor geometrically turn this "unlayered" situation into the "layered situation" of level surfaces with the new vector field being the gradient field of of a suitably differentiable function $f(x,y,z)$ of $3$ variables.  I know that the general question of integrability is very complicated. Just a good intuitive example would suffice.
I know how an integrating factor which is essentially a continuous "reweighting" of the vector field can make the required the field "exact" algebraically. What I want to get a feel for is "What is happening geometrically?". How is a vector field which is wandering around and many times trying to form closed loops and does not "layer" transformed geometrically into a vector field which is inwardly or outwardly directed by the "layered" set of level surfaces when before there were no natural surfaces to assign to the vector field?
 A: For a very simple example, take the vector field $F = e^y\ dx$.  This is not a conservative field, e.g. if you integrate $F \cdot dr$ around a loop of line segments, say $(0,0,0) \to (1,0,0) \to (1,1,0)
\to (0,1,0)$, the contribution of the segment on $y=1$ outweighs that of the segment on $y=0$.  Multiplying by the integrating factor $e^{-y}$ decreases the contribution of the segment on $y=1$ just enough that the integral around the loop is 0, giving you the conservative field $dx$.
A: As pointed out by Willie Wong, the one-form $\,\omega\,$ has an integrating factor iff it satisfies Frobenius integrability condition $\,\omega \wedge d\omega = 0$.
If we identify a one-form $\,\alpha = A\,dx + B\,dy + C\,dz\,$ with the vector field $\,X_\alpha = (A,B,C)$ and a two-form $\,\beta = E\,dy\wedge dz+ F\,dz \wedge dx + G\,dx\wedge dy$ with the vector field $X_\beta = (E,F,G)$, the condition $\,\omega \wedge d\omega = 0\,$ could be given a geometric meaning in the following sense.
In the corrispondences $\,\alpha \leftrightarrow X_\alpha$ and $\,\beta \leftrightarrow X_\beta$


*

*differentiating $\,\alpha\,$ corrisponds to take the curl of $\,X_\alpha$, i.e. $\,X_{d\alpha} = \nabla \times X_\alpha$;

*the wedge product between one-forms and two-form is the dot product, i.e. $\alpha \wedge \beta = (X_\alpha \cdot X_\beta)\,dx\wedge dy\wedge dz$


So, a one-form $\,\omega\,$ admits an integrating factor iff $\,(\nabla \times X_\omega) \cdot X_\omega  = 0\,$ (the curl of $X_\omega$ is orthogonal to $X_\omega$ itself).
A: That understanding of the integrating factor is incorrect: the integrating factor is not capable of "uncurling" closed loops. Let $V$ be an arbitrary vector field, and suppose that $V$ admits a closed integral curve $\gamma$, then if we multiply $V$ by any non-vanishing function $k$, we can find a re-parametrisation of the curve $\gamma$ such that the reparametrisation is a closed integral curve of $kV$, and so $kV$ still cannot be the gradient of any function. 
Multiplying a one form or a vector field by a non-vanishing function cannot change the directions of the vector field or the one form, but only the magnitude, and therefore is not sufficient to "uncurl" anything. 
Roughly speaking, a vector field can fail to be the gradient field of a function for two separate reasons. First is that the directions are wrong: this is the case where the integral curves can be closed. Second is that the magnitudes are wrong. The integrating factor trick is used to fix the case whre the directions are correct and the magnitudes are not. 
Roughly speaking, the integrating factor trick asks: give a one-form $\omega$, is there a function $f$ such that $\mathrm{d}f$ is proportional to $\omega$? (The directions are right, but the magnitudes are wrong.) Now, if there is, necessarily there is a function $m$ such that $m\mathrm{d}f = \omega$. Taking the exterior derivative again, you have that $\mathrm{d}\omega = \mathrm{d}m\wedge\mathrm{d}f$, and hence that necessarily $\omega \wedge \mathrm{d}\omega = 0$. That this condition is sufficient is one of the corollaries of Frobenius' theorem. 
