Flat connections on Bundles of degree 0 on a compact Riemann surface Let $\pi:E\to X$ be a holomorphic vector bundle of degree 0 over a compact Riemann surface $X$. Why does $E$ admit a flat connection. I could work this out in the case of line bundles, where one starts with the natural logarithmic connection on $\mathscr{O}(\sum_{i=0}^{k}n_iP_i)$ (here $\sum_{i=0}^{n}n_i=0$) and modify this by an element of $H^0(X,\Omega(\sum_{i=0}^{k}P_i))$ to get a holomorphic connection, which gives a flat connection.
How to prove this for a vector bundle of rank > 1?
EDIT: Thanks Richard. In the above let $E$ be an indecomposable vector bundle. Could you give a good reference for this result?
 A: Rex: A holomorphic bundle doesn't always admit a flat connection.  You need to assume further that each of its indecomposable pieces has degree 0.  This is the result of Weil [J. Math. Pures Appl. (9) 17 (1938), 47--87] and Atiyah [Trans. Amer. Math. Soc. 85 (1957), 181–207].
A: Pick any hermitian degree zero vector bundle $E\to C$ with hermitian metric $h$. Then $\det h$ is a hermitian metric on $\det E$ and $i\Theta(\det E,\det h)=-i\partial\bar\partial\log\det h$ is cohomologous to zero since $\int_C c_1(\det E)=\int_C c_1(E)=\deg_C E$. Thus, by the $\partial\bar\partial$-lemma there exists a smooth real function $\varphi$ on $C$ such that 
$$
i\Theta(\det E,\det h)=i\partial\bar\partial\varphi.
$$
Now consider the new hermitian metric $h'=he^{-\varphi/r}$ on $E$, where $r$ is the rank of $E$. Then $i\Theta(\det E,\det h')=i\Theta(\det E,\det h)-i\partial\bar\partial\varphi\equiv 0$.
This tells you that you can always construct a (hermitian) connexion $D$ on $E$ which is "Ricci-flat" (take just the Chern connection associated to the metric $h'$). This was quite elementary, and perhaps you already knew this simple construction.  
Now, suppose that you have a hermitian vector bundle $E\to X$ on a compact Kähler manifold $(X,\omega)$ of any dimension and let $c_1(E)_h, c_2(E)_h$ the first two Chern forms of $E$ with respect to any $\omega$-Hermite-Einstein metric $h$ on $E$. Then you have the so-called Kobayashi-Lübke inequality
$$
[(r-1)c_1(E)_h^2-2rc_2(E)_h]\wedge\omega^{n-2}\le 0
$$
at every point of $X$ (and hence also globally) and moreover the inequality holds if and only if
$$
\Theta(E,h)=\frac 1r c_1(E)_h\otimes\operatorname{Id}_E.
$$
As a corollary you get that if $(E,h)$ is a Hermite-Einstein vector bundle with $c_1(E)=c_2(E)=0$, then $E$ is unitary flat for some hermitian metric $h'=h e^{-\varphi}$. In fact, as before we can write $c_1(E)_h=\frac i{2\pi}\partial\bar\partial\psi$ for some real smooth function $\psi$ on $X$ and the equality case in the Kobayashi-Lübke inequality gives us
$$
\Theta(E,he^{-\psi/r})=\Theta(E,h)-\frac 1r\frac i{2\pi}\partial\bar\partial\psi\otimes\operatorname{Id}_E=0.
$$
But this holds in particular if $X$ is a curve and $E$ is a Hermite-Einstein vector bundle of degree zero.
To conclude, it can be shown that any stable vector bundle on a compact Riemann surface admits a Hermite-Einstein structure.
So, this is a proof in the stable case. As Richard pointed out, the stability assumption is clearly more restrictive, therefore this is a partial answer to your question in this case.
