Find maximum value of $\int_{1}^3\frac{f(x)}{x}dx$ if $\int_{1}^{3}f(x)dx=0$ and also $-1\leq f(x)\leq 1$
This was an exercise in the 2014 Putnam and the trick is to write for a parameter $a>0$, \begin{split} \left\lvert\int_1^3 \frac{f(x)}x\,\mathrm dx\right\rvert &= \left\lvert\int_1^3\frac{f(x)}x\,\mathrm dx -\int_1^3\frac{f(x)}a\,\mathrm dx\right\rvert\\ &=\left\lvert\int_1^3 f(x)\left(\frac1x-\frac1a\right)\,\mathrm dx\right\rvert \\ &\le\int_1^3 \lvert f(x)\rvert\left\lvert\frac1x-\frac1a\right\rvert\,\mathrm dx \\ &\le\int_1^3 \left\lvert\frac1x-\frac1a\right\rvert\,\mathrm dx \\ &=\ln\left(\frac{a^2}3\right)+\frac4a-2. \end{split}
Minimizing the last expression with $a=2$ we get $$\left\lvert\int_1^3 \frac{f(x)}x\,\mathrm dx\right\rvert\le\ln(4)-\ln(3).$$
Equality is achieved for the function suggested by @Student in the comments: $f(x)=1$ on $[1,2]$ and $f(x)=-1$ on $[2,3]$.
As usual, I will generalize.
Let $f$ be function such that $\int_{a}^{b}f(x)dx=0$ and $|f(x)|\leq 1$.
Find the best bound of $|\int_{a}^{b}f(x)g(x)dx|$ where $g(x) > 0$ and $g'(x) < 0$.
The original problem is $a=1, b=3, g(x) = \dfrac1{x}$.
For $g(a) > c > g(b)$,
$\begin{array}\\ |\int_{a}^{b}f(x)g(x)dx| &=|\int_{a}^{b}f(x)g(x)dx-c\int_{a}^{b}f(x)dx|\\ &=|\int_{a}^{b}f(x)(g(x)-c)dx|\\ &\le\int_{a}^{b}|g(x)-c|dx\\ &\le\int_{a}^{g^{-1}(c)}|g(x)-c|dx+\int_{g^{-1}(c)}^{b}|g(x)-c|dx\\ &=\int_{a}^{g^{-1}(c)}(g(x)-c)dx+\int_{g^{-1}(c)}^{b}(c-g(x))dx\\ &=c(b-2g^{-1}(c)+a)+\int_{a}^{g^{-1}(c)}g(x)dx-\int_{g^{-1}(c)}^{b}g(x)dx\\ &=c(b-2h(c)+a)+\int_{a}^{h(c)}g(x)dx-\int_{h(c)}^{b}g(x)dx \qquad h(x) = g^{-1}(x)\\ &=c(b-2h(c)+a)+G(h(c))-G(a)-G(b)+G(h(c)) \qquad G'(x) = g(x)\\ &=c(b-2h(c)+a)-(G(a)+G(b)-2G(h(c)))\\ \end{array} $
We want to minimize this.
$\begin{array}\\ r(c) &=c(b-2h(c)+a)-(G(a)+G(b)-2G(h(c)))\\ &=c(b+a)-2ch(c)-(G(a)+G(b)-2G(h(c)))\\ \text{so}\\ r'(c) &=(b+a)-2(h(c)+ch'(c))+2h'(c)G'(h(c))\\ &=(b+a)-2(h(c)+ch'(c))+2h'(c)g(h(c))\\ &=(b+a)-2(h(c)+ch'(c))+2h'(c)c\\ &=(b+a)-2h(c)\\ \end{array} $
We want $r'(c) = 0$, so $b+a = 2h(c) =2g^{-1}(c) $ so $c =g(\frac{b+a}{2}) $.
For the problem, $g(c) = \dfrac1{c}$ so $c =\dfrac{2}{b+a} $.
Then, since $G(c) = \ln(c)$ and $ch(c) = 1$,
$\begin{array}\\ r(c) &=c(b+a)-2ch(c)-(G(a)+G(b)-2G(h(c)))\\ &=\dfrac{2}{b+a}(b+a)-2-(\ln(a)+\ln(b)-2\ln(\dfrac{b+a}{2}))\\ &=-(\ln(a)+\ln(b)-2\ln(\dfrac{b+a}{2}))\\ &=\ln(\dfrac{(b+a)^2}{4ab})\\ \end{array} $
If $a=1, b=3$ this is $\ln(\frac{16}{12}) =\ln(\frac{4}{3}) =\ln(4)-\ln(3) $.