Regarding property of Dedekind sums in analytic number theory I am self studying analytic number theory from Tom M Apostol and I am not able to prove this property of Dedekind sums
$$\sum_{r=0}^k  \left(\left(\frac{hr}{k}\right)\right) = 0$$
if $\gcd(h, k) =1$ where $((x)) = x-[x] -0.5$ if $x$ is not an integer and $((x)) = 0$ if $x$ is an integer. ($[x]$ denotes greatest integer less than or equal to $x$.)
Apsotol mentions it can be proved using periodic property, that $((x))$ has period $1$ and using that $((x))$ is an odd function. But I can't see how to use these facts. 
Can somebody please give a hint. 
 A: Indeed
$$\sum_{r=0}^k  \left(\left(\frac{hr}{k}\right)\right)=\sum_{r=1}^{k-1}  \left(\left(\frac{hr}{k}\right)\right)=\\
\sum_{r=1}^{k-1} \left(\frac{hr}{k} - \left \lfloor \frac{hr}{k} \right \rfloor - \frac{1}{2}\right)=\\
\frac{h}{k}\cdot\frac{k(k-1)}{2} - \sum_{r=1}^{k-1}\left \lfloor \frac{hr}{k} \right \rfloor - \frac{k-1}{2}=\\
\frac{(h-1)(k-1)}{2} - \sum_{r=1}^{k-1}\left \lfloor \frac{hr}{k} \right \rfloor \tag{1}=...$$
But (by reordering and because $\left \lfloor x \right \rfloor + \left \lfloor -x \right \rfloor=-1$ for $x\notin \mathbb{Z}$)
$$\color{red}{\sum_{r=1}^{k-1}\left \lfloor \frac{hr}{k} \right \rfloor}=
\sum_{r=1}^{k-1}\left \lfloor \frac{h(k-r)}{k} \right \rfloor=
\sum_{r=1}^{k-1}\left \lfloor h + \left(- \frac{hr}{k}\right) \right \rfloor=\\
\sum_{r=1}^{k-1} h+\sum_{r=1}^{k-1}\left \lfloor -\frac{hr}{k} \right \rfloor=
\sum_{r=1}^{k-1} (h-1)-\sum_{r=1}^{k-1}\left \lfloor \frac{hr}{k} \right \rfloor=\\
(h-1)(k-1)-\color{red}{\sum_{r=1}^{k-1}\left \lfloor \frac{hr}{k} \right \rfloor}$$
There are more elegant proofs of this, but this is the one I remember. And finally, continuing $(1)$
$$...=0$$
