Let $n=p_1^{k_1}p_2^{k_2}\cdots p_m^{k_m}$ be a prime factorization of $n$. Each divisor $d=p_1^{l_1}p_2^{l_2}\cdots p_m^{l_m}$ of $n$ is associated with the vector $\left(l_1,l_2,\ldots,l_m\right) \in \left[k_1\right]\times \left[k_2\right]\times \ldots\times \left[k_m\right]=:S$, where $[t]:=\{0,1,2,\ldots,t\}$ for all integers $t\geq0$. Partially order the elements of $S$ with the natural order of $\mathbb{Z}$. In other words, this ordering is given by $\left(l_1,l_2,\ldots,l_m\right)\preceq \left(r_1,r_2,\ldots,r_m\right)$ iff $l_i\leq r_i$ for all $i=1,2,\ldots,m$. Note that $S$ is a lattice, and we shall write $\vee$ for the join in $S$. That is, $$\left(l_1,l_2,\ldots,l_m\right)\vee\left(r_1,r_2,\ldots,r_m\right)=\big(\max\left\{l_1,r_1\right\},\max\left\{l_2,r_2\right\},\ldots,\max\left\{l_m,r_m\right\}\big)\,.$$ (If $d$ and $e$ are divisors of $n$ associated to $a$ and $b$ in $S$, respectively, then $\text{lcm}\left(d,e\right)$ is the divisor of $n$ associated to $a\vee b\in S$.)
Define $$T:=\left\{(a,b)\in S\times S\,\big|\,a\preceq b\right\}\,.$$
Clearly,
$$|T|=\sum_{b\in S}\,\Big|\big\{a\in S\,\big|\,a\preceq b\big\}\Big|=\sum_{d\mid n}\,\tau(d)\,.$$
We want to count the number of elements of $T\times T$ in two ways. The first way is the trivial counting:
$$|T\times T|=|T|\cdot |T|=\left(\sum_{d\mid n}\,\tau(d)\right)^2\,.$$
The second way is as follows. For a fixed $b\in S$, let $N_b$ be the number of $\big((u,v),(x,y)\big)\in T\times T$ such that $v\vee y=b$. Write $u_j$, $v_j$, $x_j$, $y_j$, and $b_j$ for the $j$-th components of $u$, $v$, $x$, $y$, and $b$, respectively. For $j=1,2,\ldots,m$, we have $\max\left\{v_j,y_j\right\}=b_j$. There are $\left(1+v_j\right)\left(1+y_j\right)$ possible pairs $\left(u_j,x_j\right)$ for a given pair $\left(v_j,y_j\right)$. That is,
$$
\begin{align}
N_b&=\prod_{j=1}^m\,\left(\sum_{v_j=0}^{b_j-1}\,\left(1+v_j\right)\left(1+b_j\right)+\sum_{y_j=0}^{b_j-1}\,\left(1+b_j\right)\left(1+y_j\right)+\left(1+b_j\right)\left(1+b_j\right)\right)
\\
&=\prod_{j=1}^m\,\left(1+b_j\right)\left(2\sum_{r=0}^{b_j-1}\,\left(1+r\right)+\left(1+b_j\right)\right)
\\
&=\prod_{j=1}^m\,\left(1+b_j\right)\Big(b_j\left(1+b_j\right)+\left(1+b_j\right)\Big)=\prod_{j=1}^m\,\left(1+b_j\right)^3=\big(\tau(d)\big)^3\,,
\end{align}$$
if $d$ is the divisor of $n$ associated to $b$. Therefore,
$$|T\times T|=\sum_{b\in S}\,N_b=\sum_{d\mid n}\,\big(\tau(d)\big)^3\,.$$