Riemann's original proof (as modified by Roch) showed that for D > 0 the space of differentials of functions in L(D) is the kernel of a linear period map from C^d--->C^g. Hence the dimension l(D)-1 of that kernel satisfies d-g ≤ l(D)-1 ≤ d. Equivalently, 1+d-g ≤ l(D) ≤ d+1. He also showed that deg(K) = 2g-2, and l(K) = g. It is trivial that d<0 implies l(D) = 0. Roch showed that the cokernel of that map has dimension l(K-D), hence l(D) - l(K-D) = 1+d-g. The easy (formal) consequences are these: 1) d = deg(D) > 2g-2 implies l(D) = 1+d-g, i.e. l(D) is minimal when deg(D) > deg(K). 2) d = deg(D) > 2g-1 implies D is free, since l(D-P) must go down one, by 1). 3) d = deg(D) > 2g implies D is very ample, since both l(D-P) and l(D-P-Q) go down. Since these consequences are easy, the interesting cases are for d = deg(D) ≤ 2g-2. The first one of these is that K is very ample unless there exist P,Q with l(P+Q) > 1. The next important, less formal result is that for 1 ≤ d ≤ 2g-1, one always has 2.l(D)-2 ≤ d, a generalization of the case for D = K. Moreover, equality holds if and only if either D = K or D is a multiple of a divisor P+Q as above with l(P+Q) > 1. Good sources for this are Griffiths - Harris for Riemann and Roch's proofs, and Arbarello - Cornalba- Griffiths - Harris for the refinements. I have written a longer article on the topic available free on my website at roy smith's web page at university of georgia math department. Let me recommend especially a fabulous book by the late george kempf, abelian integrals, available from the university autonoma de mexico. this is the best source for the famous "riemann kempf" singularities theorem. for the benefit of those who will not read it, I remark that the point, derived from insights of mumford, is that the singularities of a theta divisor are modeled by those of the discriminant locus of matrices of a given rank. I.e. if you understand singularities of rank loci of matrices then you also understand singularities of theta divisors. This explains the structure of the book by Arbarello, Cornalba, Griffiths, Harris, on Geometry of Algebraic Curves.