Flat connection of a degree zero line bundle on curve The question is clear from the title. Suppose we have a line bundle on a compact smooth complex curve $X$, and a line bundle $\mathcal{L}=\mathcal{O}_X(p-q)$, where $p$ and $q$ are divisors, then what is the connection of $\mathcal{L}$.
From a local computation, it is easy to show that it should be something like $\partial log(\frac{z-z_q}{z-z_p})$ where $\frac{z-z_q}{z-z_p}$ is the ratio of the local trivialization for $\mathcal{L}$. But then the questions that are bothering me are:
1- Why this connection is trivial (exact 1-form) for $X=\mathbb{P}^1$? The singularities over $z_p$, $z_q$ cause any problem?!
2- This is a local expression, what happens for $g\ge1$? Do I need any periodicity conditions around some of the non-trivial 1-cycles?
3- What is the relation with the period matrix in Jacobian of this curve $J(X)$?
Thank you!
 A: There is not a unique connection on $\mathcal L$. Still, there is something to say: I guess you are interested in meromorphic connections with first order poles. This means that with respect to some local holomorphic frame (i.e., a local non-vanishing section) your connection 1-form is given by a meromorphic 1-form with first order poles only. Note that the residue at a singular point is well-defined, i.e. does not depend on the choice of a local holomorphic section. It seems that you are interested in the case that the residues are all $\pm1$, or slightly more general but also more natural, that all residues are integers. A particular example of such a connection on a line bundle $\mathcal L$ is given as follows: take a meromorphic section $s\neq0$ of $\mathcal L.$ Define the connection by
$\nabla s=0.$ (It is a good exercise to show that this defines a meromorphic connection with only integer residues).
This connection is trivial on $X\setminus \text{supp}(D)$, where $X$ is the curve and $D$ is the divisor of $s.$
Clearly, by adding a non-trivial holomorphic 1-form you obtain another meromorphic connection with the same residues, but this connection is not trivial. The above should answer your questions 1 and 2.
Concerning your question 3: the meromorphic connection sees the holomorphic structure of the line bundle. So you have a natural map from the space of meromorphic connections with integer residues to the Jacobian. The fiber over a representative of a point in the Jacobian given by the holomorphic line bundle $\mathcal L$ of degree 0 is given by the product of $H^0(X,K_X)$ with the space of all divisors of meromorphic sections of $\mathcal L.$
