For $n$ a natural number, let $d(n)$ denote the number of positive integer divisors of $n$. The author begins by noting that the mean value of $d(n)$ is quite different from the median value of $d(n)$ for $1\le n\le x$, say. This is because there are a few $n$ such that $d(n)$ is very large, which skews the average. This is also reflected in the moments of $d(n)$, and the author mainly concentrates on the second moment. \par Most of this article is a nice expository account of the classical result dating back to Ramanujan and later Wilson that $$ \sum_{n\le x} d(n)^2 = x P(\log x) + O(x^{1/2} \log^6 x), $$ where $P$ is a polynomial of degree 3 which may be explicitly computed if desired. In fact the error term above depends on an estimate for the fourth moment of the Riemann zeta function on the critical line, and so is somewhat better than the results obtained by Wilson. \par The main strategy here is to express the sum above using the generating Dirichlet series for $d(n)^2$ via Perron's formula. This Dirichlet series may further be expressed in terms of the Riemann zeta function (so this might serve as an introduction to the Selberg-Delange method). The author also includes a sketch of an elementary proof of the main result at the end of the article.