Vanishing of curvature tensor implies path independence of parallel transport only to second order? It can be shown that the curvature tensor measures the path independence of parallel transport only to second order.
This is somewhat understandable as we want a local (pointwise) measure of curvature, so it should be natural that $R$ essentially measures "infinitesimal" parallel transport.
It is however accepted that the curvature tensor represents the total obstruction for the integrability of parallel transport. The usual argument that proves $"R=0"\Longrightarrow \ "M$ is flat$"$ involves having an arbitrary frame $e_{(i)}$ at some point $p$ of the manifold and parallel transporting it to every other point. Since parallel transport is path independent, the result is unambigous and thus we have a parallel frame.
Question: How is the second order path independence implied by the vanishing of the curvature tensor enough for finite parallel transport to be integrable?
I have a feeling this might be trivial, but I am nontheless confused!
 A: Your question is not trivial and any proof of it that I know uses the Frobenius theorem which is a non-trivial analytic result. Let me give you an analogy which is in fact a particular case of what you're asking. Assume you have a one-form $\omega$ on some open ball $B$ in $\mathbb{R}^n$ and you want to determine a condition which guarantees that the path integral of $\omega$ depends only on the end points. Starting with such $\omega$, fix a point $p \in B$ and define a potential function $f \colon B \rightarrow \mathbb{R}$ by the formula
$$ f(x) = \int_p^x \omega $$
where the integral is done over any path which connects $p$ to $x$. Since $f$ is a smooth function, the second mixed partial derivatives of $f$ must commute and by calculating them, we see that this happens iff $d\omega = 0$. Hence, a necessary condition for the path independence of the integral is that $d\omega = 0$. This is a first order condition on $\omega$. However, by differentiating again we can get higher order conditions on $\omega$ which are also necessary. A priori, it is not clear at all that $d\omega = 0$ should be sufficient to obtain path independence but this is indeed the case which is the content of Poincare's lemma.
The situation with curvature is the same. If you have a rank $k$ vector bundle $E$ over $B$ with a connection, fix some trivialization $(e_1,\dots,e_k)$ and consider the associated connection $1$-form $\omega$ which is a lie-valued one-form. If the parallel transport is independent of the path, you can define a "potential" function $f \colon B \rightarrow \operatorname{GL}_k(\mathbb{R})$ by requiring that 
$$ P_{\gamma,p,x}(e_i(p)) = f(x)_{i}^{j} e_j(x). $$
That is, $f(x)$ tells you the matrix you need to "multiply" the frame $(e_1(x),\dots,e_k(x))$ in order to get the parallel transport of the frame $(e_1(p),\dots,e_k(p))$ from $p$ to $x$ along some (any) path. By calculating "the second derivative" of $f$, you'll see that the curvature $d\omega + \omega \wedge \omega$ must vanish and by differentiating again, you'll get other, higher order, necessary conditions in terms of $\omega$ for the path-independence of the parallel transport. However, the condition $d\omega + \omega \wedge \omega = 0$ will turn out to be sufficient by the Frobenius theorem.
If $E$ is a rank $1$-bundle then $\omega$ is a $\mathbb{R}$-valued form and the curvature becomes $d\omega$ so everything boils down to the previous case (and indeed, the Poincare lemma can be proved using the Frobenius theorem).
A: Let $\pi:P\to M$ denote the frame bundle, which is a principal $GL(n)$-bundle over $M$. One of the ways to define a connection on $P$ is by a horizontal lift operator $$\lambda_p:T_{\pi(p)}M\to T_pP$$ for every point $p\in P$ (satisfying an equivariance condiction). In particular, we obtain a splitting$$T_pP=V_p\oplus H_p,$$where $H_p$, the horizontal space, is the image of $\lambda_p$, and $V_p$, the vertical space, is the kernel of $d\pi_p$. The curvature of this connection can be thought of as a 2-form on $M$ whose values are vertical vector fields on $P$ given by$$R(X,Y)(p)=[\lambda_p(X),\lambda_p(Y)]-\lambda_p([X,Y]),$$where $X,Y\in\mathcal{X}(M)$.
If the curvature $R$ vanishes on a neighborhood $U\subset M$, then by the Frobenius theorem, the horizontal distribution on $\pi^{-1}(U)$ is integrable. This means that there is a local parallel frame, or in other words, parallel transport in $U$ is independent of the choice of path.
Now all you have left to do is convince yourself that there is a full correspondence between connections on the frame bundle and the tangent bundle, and that this correspondence extends to curvature on both bundles. This is not trivial, but described in many textbooks.
A: So here is a much simpler argument, which I find better than my previous answer.
Let $E\to M$ be a vector bundle equipped with a flat connection $\nabla$. Let $p,q\in M$, and let $\gamma_0,\gamma_1:[0,1]\to M$ be two homotopic paths connecting $p$ and $q$. Let $v\in E_p$, and we would like to show that the images of $v$ under parallel transport along $\gamma_0$ and $\gamma_1$ are the same. 
By assumption, there exists a homotopy $$H:[0,1]\times[0,1]\to M$$ satisfying $$H(0,t)=\gamma_0(t),\;H(1,t)=\gamma_1(t),\;H(s,0)=p,\;H(s,1)=q.$$We construct a section $\sigma$ of $E$ along $H$ (that is, $\sigma$ is a section of the pullback bundle $H^*E$) as follows. We set $\sigma(s,0)=v$ for $s\in[0,1]$ (this makes sense, as $H(s,0)=p$) and extend $\sigma$ to $[0,1]\times[0,1]$ so that it is everywhere parallel in the $t$ direction. We need to show that $\sigma(0,1)=\sigma(1,1)$.
By construction, we have $\nabla_t\sigma\equiv0,$ and so $\nabla_s\nabla_t\sigma\equiv0.$ As $\nabla$ is flat, we deduce $\nabla_t\nabla_s\sigma\equiv0.$ But at $t=0$ we have $\nabla_s\sigma=0$, as $\sigma$ is constant on this side of the square, and hence, we also have $\nabla_s\sigma=0$ at $t=1$. This means that $\sigma$ is constant on this side of the square, too, and in particular, $\sigma(0,1)=\sigma(1,1)$, as desired.
A: Although this question has received plenty of (very good) answers, one thing that I feel has not been explained is that how exactly does Frobenius' theorem guarantee path independence of parallel transport.
I feel I can answer this now in a way I would have liked when I asked this question.

Let $\pi:E\rightarrow M$ be a smooth rank $k$ real vector bundle with a linear connection. Furthermore, let us assume the open region $U\subseteq M$ is small enough to be trivializable and also to admit fibred charts of the form $(x^\mu,u^a)$ where the $x^\mu$ are coordinates on the base, and the $u^a$ are linear coordinates on the typical fiber. Throughout this answer I will work solely in this open set $U$.
If $\psi:U\rightarrow E$ is a smooth local section, then it is parallel if and only if $d\psi^a+\omega^a{}_b\psi^b=0$ with $\psi^a$ being the local section's components in the fibred chart and $\omega^a{}_b$ are the matrix-valued local connection forms.
It is easy to see that the parallel transport is path independent if there exists "reasonably arbitrary" parallel sections, so the question is answered if a necessary and sufficient condition is given for the solvability of the above partial differential equation for the functions $\psi^a$.
Now, if $u\mapsto H_u$ is the horizontal distribution on $E$, it can be locally generated by the system of 1-forms $$ \delta u^a=du^a+\omega^a{}_b u^b $$ on the total space $E$, where the $\omega$ 1-forms depend only on the base points, and are in fact equivalent to the local connection forms in the sense of the isomorphism between differential forms on the base, and horizontal, projectable forms on the total space.
The horizontal distribution is given as the combined annihilators of this system. The local section $\psi$ may be seen as defining a non-vertical surface in $E$. It is parallel iff this surface is horizontal, eg. it is an integral submanifold of the distribution $H$. Therefore the partial differential equation above admits solutions iff the horizontal distribution admits integral submanifolds, eg. it is integrable in the Frobenius sense (indeed the original PDE is basically $\psi^\ast\delta u^a=0$).
Applying the local coframe criterion for Frobenius' theorem, the distribution is integrable iff the exterior derivatives of the defining system of 1-forms also annihilate the horizontal. The exterior derivatives are $$ d\delta u^a=d\omega^a{}_b u^b-\omega^a{}_b\wedge du^b, $$ but for horizontal vectors we have $du^b=-\omega^b{}_c u^c,$ so $$ d\delta u^a=d\omega^a{}_bu^b+\omega^a{}_b\wedge\omega^b{}_cu^c=(d\omega^a{}_b+\omega^a{}_c\wedge\omega^c{}_b)u^b=0,$$ where the last equality is understood horizontally, however since the form here is horizontal, this is a genuine equality. And for the "reasonably arbitrary" part to be true, this must vanish for all fiber points $u$, hence we obtain the usual $$0=d\omega+\omega\wedge\omega$$ condition.
