I don't really understand the part from how did the author jumps from -pi*(1+a^2)/(1-a^2) to df/da = 2pi/a. Anyone knows how the author did it?
It is that right integral that is equal to -pi (1+a^2)/(1-a^2).
So when you add you get:
pi/a - 1/a (1-a^2)/(1+a^2) * (-pi (1+a^2)/(1-a^2)) = pi /a - (-pi/a) = 2 pi/a