On Hilbert's inequality in $n$ dimensions