proving Jensen's formula 
If $f(z)$ is analytic inside and on the circle $|z| = R$ except for zeros $a_1, a_2, ..., a_m$ of multiplicities $p_1, p_2, ... p_m$ and poles $b_1, b_2, ..., b_n$ of multiplicities $q_1, q_2, ..., q_n$ respectively and if $f(0)$ is finite and different from zero, then show that 
  $$\frac{1}{2 \pi }\int_0^{2\pi} \ln |f(Re^{i\theta}|d\theta = \ln |f(0)| + \sum_{k=1}^{m}p_k \ln \left( \frac{R}{|a_k|}\right) - \sum_{k=1}^{n}q_k \ln \left( \frac{R}{|b_k|}\right)$$

I found the paper here but I don't seem to understand the last part $(8) - (11)$. Also I think $\displaystyle \log(r_{i+1} - r_i)$ must be $\displaystyle \log \left (\frac{r_{i+1}}{r_i} \right )$ and why is there increment in the coefficient. If $n(r)$(from argument principle) is evaluated from $r_{i} - r_{i+1}$, shouldn't it only count the number of zeros between $r_i - r_{i+1}$ (which should be $1$)?
 A: I will reproduce nearly all of the proof from the paper you linked below, for ease of presentation. There were also a few typos in that document. Anyways, since $\Re[\log{z}] = \log|z|$, then by the fundamental theorem of calculus,
\begin{align}
\log|f(Re^{i\theta})| & = \Re[\log{f(Re^{i\theta})}] = \Re\left[ \log{f(0)} + \int_0^R \frac{d}{dr}\left[ (\log{f(re^{i \theta})} \right] \, dr\right] \\
& = \log|f(0)| + \Re \int_0^R \frac{f'(re^{i \theta}) e^{i \theta}}{f(re^{i \theta})} \, dr
\end{align}
Then, integrating over $\theta$, and reversing the order of integration,
\begin{align}
I = \frac{1}{2 \pi} \int_0^{2 \pi} \log| f(Re^{i \theta})| \, d\theta & = \log|f(0)| + \frac{1}{2 \pi} \Re \int_0^{2 \pi} \int_0^R \frac{f'(re^{i \theta}) e^{i \theta}}{f(re^{i \theta})} \, dr \, d\theta\\
& = \log|f(0)| + \Re  \int_0^R \frac{1}{ 2\pi ir}\int_0^{2 \pi} \frac{f'(re^{i \theta}) rie^{i \theta}}{rf(e^{i \theta})} \, d\theta \, dr \\
& = \log|f(0)| + \Re \int_0^R \frac{1}{2\pi ir} \int_{C_r} \frac{f'(z)}{f(z)} \, dz \, dr,
\end{align}
where $C_r$ is the circle of radius $r$. Now, by the argument principle, 
$$ \frac{1}{2 \pi i } \int_{C_r} \frac{f'(z)}{f(z)} \, dz = \sum_{|a_k| < r} p_k - \sum_{|b_k| < r} q_k := n(r)$$
Since $n(r)$ is a real number, we conclude that
\begin{align}
I = \frac{1}{2 \pi} \int_0^{2 \pi} \log| f(Re^{i \theta})| \, d\theta & = \log|f(0)| + \int_0^R \frac{n(r)}{r} \, dr 
\end{align}
Now, let $0 < r_1 \le \ldots \le r_{m+n} < R$ be the ordered magnitudes of the poles and zeros $a_k, b_k$. Then $n(r)$ is constant on the interval $(r_j, r_{j+1})$.  Set $r_0 = 0$ and $r_{m+n+1} = R$ for simplicity. Denote its value on this interval by $n_j$. Then
\begin{align}
I - \log|f(0)| & = \sum_{j=0}^{m+n} \int_{r_j}^{r_{j+1}} \frac{n(r)}{r} \, dr =  \sum_{j=1}^{m+n} \int_{r_j}^{r_{j+1}} \frac{n_j}{r} \, dr = \sum_{j=1}^{m+n} n_j [\log(r_{j+1}) - \log(r_j)] \\
& = -n_1 \log{r_1} + (n_1 - n_2) \log{r_2} + \ldots + (n_{m+n-1} - n_{m+n}) \log{r_{m+n}} + n_{m+n} \log{R}
\end{align}
Now, what is $n_{j+1} - n_{j}$? It is precisely the multiplicity ($\pm$ depending on whether it is a zero or a pole) of the pole/zero of radius $r_{j+1}$, because that's how much $n(r)$ changes by when the radius passes from $r < r_{j+1}$ to $r > r_{j+1}$. So then 
\begin{align}
I & = \log|f(0)| - \sum_{k=1}^m p_k \log |a_k| + \sum_{k=1}^n q_k \log|b_k| + n_{m+n} \log{R} \\
& = \log|f(0)| + \sum_{k=1}^m p_k \log(R/|a_k|) - \sum_{k=1}^n q_k \log(R/|b_k|),
\end{align}
where the last equality holds because $n_{m+n} = \sum_{k} p_k - \sum_k q_k$, and then combining the logarithms. 
