I have read in the paper by Einsiedler, Lindenstrauss, Michel and Venkatesh on Duke's Theorem the following bound that I don't understand: 


Let $d$ be a positive non-square interger and set let $K = \mathbb{Q}(\sqrt{d})$ and denote by $\mathcal{O}\_K$ the ring of integers of $K$. We furthermore assume that $d$ is a discriminant, i.e. $d = 0,1 \mod 4$. 


Then consider the order $$\mathcal{O}\_d := \mathbb{Z}[\tfrac{d + \sqrt{d}}{2}] \subset \mathcal{O}\_K.$$ We call an ideal $\mathfrak{a} \subset \mathcal{O}\_d$ a proper $\mathcal{O}\_d$-ideal if it is a $\mathbb{Z}$-module of rank 2 such that $$\mathcal{O}\_d = \{ \lambda \in K \,:\, \lambda \mathfrak{a} \subset \mathfrak{a} \}.$$ The bound I am interested in is now the following: The number of proper $\mathcal{O}\_d$-ideals $\mathfrak{a} \subset \mathcal{O}\_K$ of norm equal to $n$ is bounded by the number of divisors of $n$, in formulas:


$$|\{\text{proper } \mathcal{O}\_d \text{-ideals } \mathfrak{a} \subset \mathcal{O}\_K \text{ with } N(\mathfrak{a}) = n \}| \leq |\{ \text{divisors of } n \}|.$$



Bound on number of proper ideals of norm equal to n
Here is a solution for counting ideals of a given norm in $\mathcal O\_K$ with $K$ being a general number field. By relating the count of *proper* ideals with a given norm in a non-maximal order to counting ideals with a given norm in the maximal order containing it, I suspect the case of non-maximal orders could be deduced from the case of maximal orders, but I haven't thought that through.


For ${\rm Re}(s) > 1$, the Dirichlet series for $\zeta\_K(s)$ can be written as 
$\sum\_{n \geq 1} a\_n/n^s$ where $a\_n$ is the number of ideals in $\mathcal O\_K$ with norm $n$. We want to get an upper bound on $a\_n$. Write the Euler product for $\zeta\_K(s)$ as a product where all prime ideals dividing a given rational prime appear together:
$$
\zeta\_K(s) = \prod\_{p} \prod\_{\mathfrak p \mid p} \frac{1}{1 - 1/{\rm N}(\mathfrak p)^s}.
$$
For each $\mathfrak p$ dividing $p$, ${\rm N}(\mathfrak p) \geq p$ and there are at most $[K:\mathbf Q]$ prime ideals in $\mathcal O\_K$ dividing $p$, so 
for *real* $s > 1$ we have $1/(1 - 1/{\rm N}(\mathfrak p)^s) \leq 1/(1 - 1/p^s)$ and therefore 
$$
\zeta\_K(s) \leq \prod\_{p} \left(\frac{1}{1 - 1/p^s}\right)^m = \zeta(s)^m,
$$ 
where $m = [K:\mathbf Q]$. Thus the number $a\_n = |\{\mathfrak a \subset \mathcal O\_K : {\rm N}(\mathfrak a) = n\}|$ is at most the coefficient of $1/n^s$ in the Dirichlet series for $\zeta(s)^m$. 


Multiplying Dirichlet series uses "Dirichlet convolution" on the coefficients:
$$
\sum\_{n \geq 1} \frac{b\_n}{n^s} \sum\_{n \geq 1} \frac{c\_n}{n^s} = 
\sum\_{n \geq 1} \left(\sum\_{d \mid n} b\_dc\_{n/d}\right)\frac{1}{n^s}.
$$
In particular, taking $b\_n = c\_n = 1$, the sum $\sum\_{d \mid n} b\_dc\_{n/d}$ is 
the number of (positive) divisors of $n$. Writing that as $\tau(n)$, 
we get $\zeta(s)^2 = \sum\_{n \geq 1} \tau(n)/n^s$, so $a\_n \leq \tau(n)$ when $[K:\mathbf Q] = 2$. That tells you what you want when $\mathcal O\_d = \mathcal O\_K$ for all quadratic $K$ (not just real quadratic $K$).


The Euler product of $\zeta(s)^m$ is $\prod\_{p} 1/(1-1/p^s)^m$, so by the power series $1/(1-x)^m = \sum\_{k \geq 0} \binom{k+m-1}{k}x^k$ for $|x| < 1$ with $x = 1/p^s$, the coefficient of $1/n^s$ in $\zeta(s)^m$ can be expressed in terms of the prime factorization $n = p\_1^{k\_1}\cdots p\_r^{k\_r}$ as 
$$
\binom{k\_1 + m-1}{k\_1} \cdots \binom{k\_r+m-1}{k\_r}.
$$
Thus in general, 
$$
[K:\mathbf Q] = m \text{ and } n = p\_1^{k\_1}\cdots p\_r^{k\_r} \Longrightarrow a\_n \leq \binom{k\_1 + m-1}{k\_1} \cdots \binom{k\_r+m-1}{k\_r}.
$$
When $m = 2$, the upper bound is $(k\_1+1)\cdots (k\_r+1)$, which is $\tau(n)$. 
For all $m$ we have $\binom{k+m-1}{k} \leq (k+1)^{m-1}$, so 
$a\_n \leq \tau(n)^{m-1}$ for all $n$. That is a small savings in the exponent compared to the bound $a\_n \leq \tau(n)^m$ that I mentioned from Borevich and Shafarevich's *Number Theory* in a comment to the question, although I think the same savings could probably be obtained from B&S's own proof.


Edit: The use of Dirichlet series is not strictly necessary, as the number of ideals in $\mathcal O\_K$ with norm $n = p\_1^{k\_1}\cdots p\_r^{k\_r}$ is the product of the number of ideals of norm $p\_i^{k\_i}$ for each $i$, and the count of ideals with prime-power norm $p^k$ can be bounded by the count that could occur if $p$ split completely (to maximize the number of possibilities). Nevertheless, the convenience of using Dirichlet series (really, an Euler product) is the same reason that it's often convenient to use generating functions to answer combinatorial questions.


