A vector bundle is said to be flat if it is endowed with an linear connection with vanishing curvature, ie. a flat connection.
Is the tangent bundle $TS^2$ of a $S^2$ flat? My question is also about how do we know if our bundle is flat or not? What are the obstacles to this?
Let we have a flat connection $\nabla$. This is equivalent to the fact that we have a parallel transport $P_{\gamma (t)}$. Fundamental group $\pi_1 (S^2) = 0$. Then parallel transport is path-independent (because connection is flat). We can take an arbitrary vector $X \in T_pS^2$ and spread it around the manifold by the parallel transport. Thus, we obtain a non-trivial nondegenerate global vector field $X(q)$, where $q \in M$. But this contradicts the Hairy ball theorem.
Is my reasoning correct?
Your reasoning indeed shows that No, there is no flat connection on $ TS^2 $.
The way you phrased your question brings up an important distinction that needs to be made: It actually doesn't make sense to ask "is this bundle flat?" Instead we must ask, "Is this connection on this bundle flat?" or "Does this bundle admit a flat connection?" That is, "flatness" is a property of a connection on a bundle, not a property of the bundle itself.
The distinction is not just nit-pickiness, it does matter. For example, the tangent bundle to the torus admits a flat connection, but when most of us think of the torus as the surface of a donut sitting in $\mathbb R^3$, we are actually thinking of it as being equipped with a non-flat connection.
For the two-sphere you could, if you wanted, choose some appropriate neighborhood of a point and find a connection with no curvature in this neighborhood. Intuitively this is like taking the L.C. connection on a sphere where we've flattened part of it (a deflated ball resting on a flat surface). But it is impossible to do this everywhere on the sphere:
It turns out that there are some vector bundles where you simply cannot find any connection which is flat everywhere, and I think this is what your original question was probably about. Chern-Weil theory is the precise version of that statement. It says roughly that some vector bundles (like the tangent bundle to $S^2$) have certain topological quantities (like the Euler characteristic of $S^2$) that can be computed from the curvature of a (metric) connection on that bundle. When these topological quantities are nonzero (like $\chi(S^2)=2$) then flat connections are forbidden by the topology of the bundle. I mentioned Chern-Weil theory, but really the Chern-Gauss-Bonnet theorem is sufficient to argue that $TS^2$ does not admit a flat connection.