For a problem like this, where the weight density is constant, lswtech's idea is easiest- the center of mass is exactly at the middle of the cable and lifting the cable requires the same work as if the total mass were concentrated at the center of mass. Just a couple of simple arithmetic operations.
More generally (and a way of showing that the previous statement is true), focus on some small section of chain, of length [tex]\Delta x[/tex], at height x below the surface. If the weight density is [tex]\gamma(x)[/tex], then the weight of that little section is (approximately) [tex]\gamma(x)\Delta x[/tex] and it has to be lifted a distance x. It takes (approximately) [tex]\gamma(x) x\Delta x[/tex] work to lift it to the surface. Dividing the entire cable into pieces and adding the work required to lift each piece, the total work would be (approximately) [tex]\sum \gamma(x) x \Delta x[/tex].
The reason for the repeated "approximately"s is that if the density is NOT constant, and [tex]\Delta x[/tex] is not "infinitesmal", the weight is not simply a product. But that is a "Riemann" sum, as is used to define the definite integral. If take the limit as [tex]\Delta x[/tex] gets smaller and smaller, becoming "infinitesmal", it becomes exact: the work is given by
[tex]\int \gamma(x) x dx[/tex]
If, in particular, [itex]\gamma[/itex] is a constant, we can take it out of the integral:
[tex]\gamma \int_0^L x dx[/tex]
(I have put in 0 and L as the distances of the two ends of the cable- it extends down from 0 to its length L.)
That is easily seen to be
[tex]\left[\gamma \frac{x^2}{2}\right]_0^L= \gamma \frac{L^2}{2}= \left(\gamma L\right)\left(\frac{L}{2}\right)[/tex]
where at the end I have factored to show it is "[itex]\gamma L[/itex]" times "[itex]L/2[/itex]", the weight of the cable times the distance it midpoint is lifted.