We assume as below, that we have convergent Fourier series for ##f##, so that it can be integrated term by term, and we assume that the integrals in the exercise are convergent, that is, that on the left hand side we have Cauchy principal value of the integral.
Then:
$$f(x) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n \cos(2nx) + \sum_{n=1}^\infty b_n \sin(2nx)$$
From the convergence of the integral, we conclude that the sine series will give zero integrating term by term, since it is an odd function on a symmetric interval.
For the cosine part, the term we're integrating looks like:
$$\int_{-\infty}^{\infty} \cos(2nx) \frac{\tan(x)}{x}dx $$
Now we will search for principal value by using contour integration. Our contour will be anti-clockwise directed semicircle in the upper-half plane with infinite diameter along the real axis of the complex plane(a very standard contour, I don't have any good way to draw it here, so I assume the description of it is sufficient).
The function we will be integrating along this contour will be:
$$f(z) = e^{i(2nx)}\frac{\sin(z)}{z\cos(z)}$$
This function has simple poles at ##z = 0## and ##z = k\pi + \tfrac{\pi}{2}##, all along the real axis, so we will evade all of these poles by constructing small semi-circles in the upper-half plane around each pole, clockwise. This way, we won't have any poles inside the contour.
So, denoting the small semi-circles by ##C_0## and ##C_k##, the real axis part of the contour by ##\gamma##, the big semi-circle by ##C_R##, and the full contour by ##C##, we have:
$$\oint_C f(z)dz = \oint_{C_0} f(z)dz + \sum_{k=-m+1}^{m} \oint_{C_k}f(z)dz + \oint_{\gamma} f(z)dz + \oint_{C^+} f(z)dz$$
By Cauchy's residue theorem the total integral is zero since we have no poles inside the contour.
For the semicircles we will use Jordan's lemma. For now, we will assume the contour to be of finite width ##2R## with ##2m## poles in between(##k = -(m-1), \dots, m##), and in the end we will extend this contour to infinity.
For small semicircles, we have:
$$\lim_{r_k \rightarrow 0}\oint_{C_k} f(z)dz = -i\pi Res(f,k\pi+\tfrac{\pi}{2})$$
$$\lim_{r \rightarrow 0}\oint_{C_0} f(z)dz = -i\pi Res(f,0)$$
where we denoted the radii of the semicircles around the poles with ##r_k## and ##r##.
We calculate the residues:
$$Res(f,0) = \lim_{z \rightarrow 0} zf(z) = 0$$
$$Res(f,k\pi+\tfrac{\pi}{2}) = \lim_{z \rightarrow k\pi + \tfrac{\pi}{2}} \left(z - k\pi -\frac{\pi}{2}\right)f(z) = e^{i(2n(k\pi+\tfrac{\pi}{2}))}\sin\left(k\pi + \frac{\pi}{2}\right)\frac{2}{(2k+1)\pi} \lim_{z \rightarrow k\pi + \tfrac{\pi}{2}} \frac{z - k\pi - \frac{\pi}{2}}{\cos(z)} = (-1)^{(n+k)}\frac{2}{(2k+1)\pi} (-1)^{(k+1)} = \frac{2(-1)^{(n+1)}}{(2k+1)\pi}$$
Integral along the real axis(which we denoted by ##\gamma##) is:
$$\oint_{\gamma} f(z)dz = \int_{-R}^{R}e^{i(2nx)}\frac{\sin(x)}{x\cos(x)}dx$$
Combining the results above, we have:
$$ 0 = \oint_{C_R}f(z)dz + \int_{-R}^{R}e^{i(2nx)}\frac{\sin(x)}{x\cos(x)}dx +(-1)^n\sum_{k=-m+1}^{m} \frac{2i}{2k+1}$$
The integral we're looking for is the real part of the principal value we see in the expression above with boundaries going to infinity. When we take boundaries to infinity, ##C_R## integral will drop to zero, because by closing the contour anticlockwise in the upper-half of the plane, we obtained exponential damping of the integrand, so this limit will follow from Jordan's lemma. The sum that we have in the last term will diverge, however this sum is purely imaginary, the real part will still be zero. So we conclude that the real part of our integral is zero:
$$p.v. \int_{-\infty}^{\infty} \cos(2nx)\frac{\sin(x)}{x\cos(x)}dx = 0$$
This means that our cosine series will be integrated to zero term by term. We're left only with the constant term. So we have:
$$\int_{-\infty}^{\infty} f(x)\frac{\tan(x)}{x}dx = \frac{a_0}{2}\int_{\infty}^\infty \frac{\tan(x)}{x}dx$$
Where we're looking for the Cauchy principal value of the integral, as before. We will perform the same type of calculation as with the cosine series, this time working with the function:
$$f(z) = \frac{e^{iz}}{z\cos(z)}$$
The contour and method are completely identical, so we will proceed to calculate the residues:
$$Res(f,0) = 1$$
$$Res(f,k\pi + \frac{\pi}{2}) = \frac{-2i}{(2k+1)\pi}$$
From Cauchy integral theorem, we find:
$$0 = \oint_{C_R}f(z)dz -i\pi -\sum_{k=-m+1}^m \frac{2}{(2k+1)} + \int_{R}^{R} \frac{e^{ix}}{x\cos(x)}dx$$
Letting ##R## go to infinity, we find that the integral along the big semicircle ##C_R## goes to zero, analogous to the cosine-series case, and that the sum is divergent. However, the integral we're computing is imaginary part of the principal value in the formula above, and the sum is purely real. So we conclude:
$$p.v. \int_{-\infty}^{\infty} \frac{\tan(x)}{x}dx = \pi$$
Finally, we obtain:
$$p.v. \int_{-\infty}^{\infty} f(x)\frac{\tan(x)}{x}dx = \frac{\pi a_0}{2} = \int_0^\pi f(x)dx$$
So the correct identity is with Cauchy principal value on the left.