Question: Let $d(n)=\sum_{d|n}1$, be the divisor function. Estimate the asymptotic behaver $$D(N):=\max\{d(n):1\leq n\leq N\}$$ when $N$ is large.
I know $$\sum_{n=1}^N d(n)=\sum_{n=1}^N [\frac{N}{n}]=N\sum_{n=1}^N\frac{1}{n} + O(N)\approx N{\rm log} N.$$ So $D(N)\geq \frac{1}{N}\sum_{n=1}^N d(n)\approx {\rm log}N$. But I can't determine if this is optimal, i.e. $D(N)=O({\rm log}N)$.
Wigert showed the bound $$ d(n) \leq e^{(\log 2 + o(1))(\log n / \log \log n)}.$$ There are other ways of approaching this bound, but I think it's not too hard to show bounds of this shape. We'll do this in two ways.
Naive primorials
Let $P_m = \prod_{j \leq m} p_j$ denote the $m$th primorial, the product of the first $m$ primes. One way to get numbers with lots of divisors would be to consider the primorials. These aren't necessarily the best, but the number of divisors of $P_m$ is $2^m$, a very easy number to understand.
The prime number theorem implies that $P_m \sim e^{O(1) m / \log m}$. Thus $P_m \lesssim n$ if $m \lesssim \frac{\log n}{\log \log n}$. Such a $P_m$ will have at least $$ 2^m \sim 2^{O(1) \log n / \log \log n}$$ divisors, which is of the claimed size.
Direct bounds
Instead of using primorials as approximations for numbers with maximal numbers of divisors (which they aren't, actually), we can be more precise with a bit of extra work. I repeat this analysis from Terry Tao, though it appears in various places in the literature.
Suppose $$ n = \prod p_j^{\alpha_j}.$$ Then $$ d(n) = \prod (1 + \alpha_j). $$ Consider the ratio $$ \frac{d(n)}{n^\epsilon} = \prod \frac{1 + \alpha_j}{p_j^{\alpha_j \epsilon}} $$ for an $\epsilon > 0$ that we will optimize later. For each prime $p_j$, the factor $\frac{1 + \alpha_j}{p_j^{\alpha_j \epsilon}}$ will be small when $p_j$ is large (in comparison to $\epsilon$). When $p_j > O(1 / \epsilon)$, for example, we find that $$ p_j^{\alpha_j \epsilon} > e^{\alpha_j} \geq 1 + \alpha_j, $$ and thus for such primes $$ \frac{1 + \alpha_j}{p_j^{\alpha_j \epsilon}} \leq 1. $$
For small primes, when $p_j < O(1 / \epsilon)$, Taylor expansion show that $$ p_j^{\alpha_j \epsilon} = \exp(\epsilon \alpha_j \log p_j) \geq 1 + \epsilon \alpha_j \log p_j. $$ Thus for such primes, $$ \frac{1 + \alpha_j}{p_j^{\alpha_j \epsilon}} \leq \frac{1 + \alpha_j}{1 + \alpha_j \epsilon \log p_j} \leq O\left( \frac{1}{\epsilon \log p_j}\right),$$ where the implicit constant does not depend on $\alpha_j$.
Thus in total, we find that $$ \frac{d(n)}{n^\epsilon} \ll \prod_{p < O(1/\epsilon)} O\left(\frac{1}{\epsilon \log p_j}\right) \ll O\left( \frac{1}{\epsilon} \right)^{\exp(1/\epsilon)} = \exp(\exp(O(1/\epsilon))). $$ (We bound $\log p_j$ by a constant $\log 2$ trivially, and the number of primes trivially). Therefore we find that $$ d(n) \ll n^{\epsilon} \exp (\exp (O(1/\epsilon))). $$ Choosing $\epsilon = C / \log \log n$ for sufficiently large $C$ causes $n^{\epsilon}$ to dominate, giving the claimed bound.
This shows an upper bound.