How many k-dimensional $\mathbb{Z}_q$-submodule over $\mathbb{Z}_q^d$? Denote $\mathbb{Z}_q$ be the residue ring of module $q$ with $q=p^r$ be a prime power.
Similar to the question for $k$-dimensional vector spaces over finite fields, we can also define a $k$-dimensional $\mathbb{Z}_q$-submodule in $\mathbb{Z}_q^d$ as the following:
$$ V = \mathrm{span}\{v_1,\dots,v_k\} $$
where $v_1,\dots,v_k \in \mathbb{Z}_q^d$ are linearly independent, namely, if there exist $a_1,a_2,\dots,a_k \in \mathbb{Z}_q$ such that $a_1v_1+a_2v_2+\dots+a_kv_k = 0$ then $a_1=a_2=\dots=a_k = 0.$
Question: How many $k-$ dimensional $\mathbb{Z}_q$-submodule in $\mathbb{Z}_q^d$? And, how many bases for a $k$-dimensional submodule?
The related question for the case of finite fields was done, you can follow via the link:
How to count number of bases and subspaces of a given dimension in a vector space over a finite field?
 A: Your independence condition means a rank $k$ free submodule, there are also many non-free submodules.
Let $M(d,k,p^r)$ be the set of matrices $A\in \Bbb{Z}/(p^r)^{d\times k}$ such that its reduction $A\bmod p$ (a matrix $ \in \Bbb{Z}/(p)^{d\times k}$) has its $k$ columns linearly independent in the vector space $\Bbb{Z}/(p)^d$.
$$W=\{ span(v_1,\ldots,v_k), \sum_{j=1}^k c_j v_j=0\implies c_1=\ldots =c_k=0\}= M(d,k,p^r)/M(k,k,p^r) $$
The group $M(k,k,p^r)$ acts on $M(d,k,p^r)$ on the right and $M(d,k,p^r)/M(k,k,p^r)$ is the set of orbits, the columns of $A\in M(d,k,p^r)$ represent the $v_j$ and the action of $M(k,k,p^r)$ changes the $v_j$ without changing the submodule it generates.
$$\# W= \frac{\# M(d,k,p^r)}{\# M(k,k,p^r)}=\frac{p^{kd(r-1)}\# M(d,k,p)}{p^{kk(r-1)}\# M(k,k,p)}= \frac{p^{kd(r-1)}\prod_{l=0}^{k-1}(p^d-p^l)}{p^{kk(r-1)}\prod_{l=0}^{k-1}(p^k-p^l)}$$

*

*where $p^{kd(r-1)}$ represents the number of matrices having the same reduction modulo $p$


*$\prod_{l=0}^{k-1}(p^d-p^l)$ means choosing $v_1\bmod p$ in $\Bbb{Z}/(p)^d-\{0\}$,  then choosing $v_2\bmod p$ in $\Bbb{Z}/(p)^d-span(v_1)$, choosing $v_3\bmod p$ in $\Bbb{Z}/(p)^d-span(v_1,v_2)$, and so on.
A: Although my idea is the same as reuns, this is coming from a little nature observability.
It is obvious that $\mathrm{span}\{\mathbf{v}^1,\dots,\mathbf{v}^k\} = \mathrm{span}\{\mathbf{u}^1,\dots,\mathbf{u}^k\}$ if only if there exists exactly one invertible matrix $A$ in $M_{k}\left(\mathbb{Z}_q\right)$ such that
\begin{equation}\label{eq.matrix}
\left(\mathbf{u}^1,\dots,\mathbf{u}^k\right)^T = A \cdot \left(\mathbf{v}^1,\dots,\mathbf{v}^k\right)^T
\end{equation}
Therefore, a $k$-dimensional submodule $V$ has $|\mathrm{GL}_k(\mathbb{Z}_q)|$ bases, where $\mathrm{GL}_k(\mathbb{Z}_q)$ is the sets of invertible matrices in $M_k\left(\mathbb{Z}_q\right)$ (note that a matrix in $M_k\left(\mathbb{Z}_q\right)$ with nonzero determinant may not be in $\mathrm{GL}_k(\mathbb{Z}_q)$). Denote $N$ be the number of $k$-dimensional submodules in $\mathbb{Z}_q^d,$ it follows that
$$ N = \dfrac{|T_k(\mathbb{Z}_q^d)|}{\left|\mathrm{GL}_k(\mathbb{Z}_q)\right|} $$
where $T_k\left(\mathbb{Z}^d_q\right) = \left\{ \left(\mathbf{v}^1,\dots,\mathbf{v}^k\right) \in \left(\mathbb{Z}_q^d\right)^k\,:\, \mathbf{v}^1,\dots,\mathbf{v}^k \text{ are linearly independent}\right\}.$ Since the Kernel of the canonical projection $K$ from $\mathrm{GL}_k(\mathbb{Z}_q)$ to $\mathrm{GL}(\mathbb{Z}_p)$ defined by
$$ K : \quad A \mapsto A \,\,\mbox{mod}\,\,p,$$
has size of $p^{k^2(r-1)},$ we have
$$ \left|\mathrm{GL}_k\left(\mathbb{Z}_q\right)\right| = p^{k^2(r-1)}\left|\mathrm{GL}_k\left(\mathbb{Z}_p\right)\right| = p^{k^2(r-1)}\left(p^k-1\right)\left(p^k-p^2\right)\dots\left(p^k - p^{k-1}\right).$$
Similarly, we also have
$$ \left|T_k\left(\mathbb{Z}_q^d\right)\right| = p^{kd(r-1)} \left|T_k\left(\mathbb{Z}_p^d\right)\right| = p^{kd(r-1)}\left(p^d-1\right)\left(p^d-p^2\right) \dots \left(p^d-p^{k-1}\right).  $$
It follows that
$$   N = \dfrac{p^{kd(r-1)} (p^d-1)(p^d-p^2)\dots (p^d-p^{k-1})}{p^{k^2(r-1)}(p^k-1)(p^k-p^2)\dots (p^{k}-p^{k-1})}.$$
