We can prime factorize any number $n$ as
$n = p^a\cdot q^b\cdot r^c ...$
The number of factors of $n$ can be defined as the number of ways to select a subset these prime factors ($x^3$ as prime factor means we have total 4 ways of selecting $x$ in our factor as either $x^0, x^1, x^2, x^3$) as each subset will represent a different factor, so
Number of factors of $n =(a + 1)(b+1)(c+1)...$
For number of factors to be odd, all of $a, b, c, ...$ have to be even, thus the number has to be a perfect square.
From $1...N$ we have approximately $\sqrt{N}$ perfect squares, so the probability that a uniformly random number $a \in \{1, 2,... ,N\}$ is $\approx\dfrac{\sqrt{N}}{N}$
$\approx \dfrac{1}{\sqrt{N}}$