I am trying to understand following proof.
One definition the author uses: The locus of zeros of a function $f(z, K)$ with respect to $K > 0$ is the set of all points $z$ such that for some $K_0$, $f(z, K_0)=0$.
I can understand every sentence of the proof. But my confusion is: it seems to me it only proves necessity. Am I understanding wrong?
You're right: the proof is incomplete. In particular, the sentence
is unjustified because the condition on arguments was only shown to be a necessary condition for $z$ to be in the locus, not a sufficient condition.
However, this gap is easy to fill, essentially by reversing the argument. If $\sum \arg(z-z_i)-\sum \arg(z-p_i)$ is an even multiple of $\pi$, then $g(z)/h(z)$ has argument an even multiple of $\pi$ and is thus a positive real number. We can thus set $K=g(z)/h(z)$ and then $f(z,K)=0$.
(Note that I assume that $z$ is not allowed to be a zero of $g$ or $h$, so that we may assume these arguments are defined. Indeed, if $g$ and $h$ have real common zeroes then the result is not correct, since such common zeroes are zeroes of $f(z,K)$ regardless of how many zeroes have greater real part.)
Incidentally, I would read the statement of the Theorem to only be asserting the converse of the direction that is proved: it only claims that certain points are in the locus, not that no other points are in the locus. It appears from the proof, though, that the author meant both directions to be included in the statement.