I am considering $U(N)$ principal bundle on a two-dimensional sphere $S^2$. (Below the fiber is $N\times N$ unitary matrices for simplicity, and any generalization to general representations will be appreciated.)
The bundle is defined by the transition function $t(\theta)\in U(N)$ along the equator $S^1$ parametrized by $\theta\in[0,2\pi)$. I am trying to calculate the first Chern number of this bundle and wondering whether it is generally possible to do a (globally defined, of course) gauge transformation to get an equivalent principal bundle defined by $\tilde{t}(\theta)$ so that \begin{eqnarray} \tilde{t}(\theta)\in \left[U(1)\right]^N, \end{eqnarray} where $\left[U(1)\right]^N$ is the Cartan subgroup of $U(N)$, namely diagonal matrices.
Does such gauge transformation exist generally? If so, the first Chern number can be always calculated by abelian subgroup.
Yes. And you can do better.
Observe that the clutching function is determined by its homotopy class $t\in \pi_1(U(N))$. Note that there is a homeomorphism $U(N)\cong U(1)\times SU(N)$. Since $SU(N)$ is simply connected we get $\pi_1(U(N))\cong \pi_1(U(1))$, so we can choose $t$ to factor through the inclusion $U(1)\hookrightarrow U(N)$ up to homotopy as $t:S^1\xrightarrow{\bar t}U(1)\hookrightarrow U(N)$, and $U(1)$ certainly lies inside the diagonal subgroup $U(1)^N$.
So yes, the first Chern class of any bundle over $S^2$ (in fact over any 2- or 3-dimensional CW complex) is determined by the abelian subgroup $U(1)$. For higher dimensional spaces this will not always be true.
Note that this is not the same as the diagonal $U(1)$-subgroup, consisting of matrices $\lambda\cdot I_n$ with $\lambda \in S^1$. The inclusion of this subgroup induces multiplication by $N$ on $\pi_1$, since it factors as $\pi_1(U(1))\xrightarrow{\Delta}\pi_1(U(1)^N)\hookrightarrow \pi_1(U(N))$ where the first map is induced by the diagonal. This means that $t$ is deformable to a map in the image of this incusion if and only if it has degree $0\mod N$.