I like to prove in elementary way that $$ \sum_{k=1}^x\sum_{j=1}^k f\left(\frac jk\right)M\left(\frac xk\right)=\sum_{\nu=1}^{A(x)}f(r_{\nu}) $$ where $$ M(x)=\sum_{1\leq l\leq x} \mu(l) $$ $\mu$ Moebius function, $$ A(x)=\sum_{n=1}^x\phi(n) $$ $r_\nu$'s are positive (reduced) rational with denominator less than or equal to $x$.
For example if $x=5$ then we have
$\sum_{k=1}^x\sum_{j=1}^k f\left(\frac jk\right)M\left(\frac xk\right)=f (1/5) + f (1/4) + f (1/3) + f (2/5) + f (1/2) + f (3/5) + f (2/3) + f (3/4) + f (4/5) + f (1)$
With $\frac{j}{k} =\frac{ma}{mb}, a\le b\le x,\gcd(a,b)=1$ we get
$$\sum_{k=1}^x\sum_{j=1}^k f\left(\frac jk\right)M\left(\frac xk\right)=\sum_{ a\le b\le x,\gcd(a,b)=1}f(\frac{a}b) \sum_{m \le x/b} M(\frac{x}{mb})=\sum_{ a\le b\le x,\gcd(a,b)=1}f(\frac{a}b) $$
$\sum_{n \le x}\phi(n)$ is the number of terms in the latter summation not the maximal denominator.
The $x$-th Farey sequence is the set $\{\frac{a}{b}, a\le b\le x\}$ often munished with the $\Bbb{Q}$-ordering.