$$ \text{Let } p \text{ be an odd prime number, and let } m \ge 0 \text{ and } N \ge 1 \text{ be integers. Let } \Lambda \text{ be a free } \mathbb{Z}/p^N\mathbb{Z} \text{-module of rank } 2m+1, \text{ equipped with a perfect symmetric } \mathbb{Z}/p^N\mathbb{Z} \text{-bilinear form} \; (\, ,\,): \Lambda \times \Lambda \to \mathbb{Z}/p^N\mathbb{Z}. $$
$$ \text{Here "perfect" means that the induced map} $$
$$ \Lambda \to \text{Hom}_{\mathbb{Z}/p^N\mathbb{Z}}(\Lambda, \mathbb{Z}/p^N\mathbb{Z}), \; x \mapsto (x,\cdot) $$
$$ \text{is an isomorphism. Find the cardinality of the set} $$
$$ \{x \in \Lambda: (x,x)=0\} $$
$$ \text{expressed in terms of } p, m, N. $$
My attemp
First I consider what it means for $(x,x)=0$. This means that $x$ is orthogonal to itself with respect to the bilinear form. $x$ is in the orthogonal complement of itself. Since $\Lambda$ is of rank $2m+1$, the orthogonal complement of $x$ is a subspace of dimension $2m$.
Let $\Lambda = (\mathbb{Z}/p^N\mathbb{Z})^{2m+1}$. The perfect condition implies that the homomorphism $f(y) = (x,y)$ is nonzero for all $x\ne 0$ in $\Lambda$.
Consider a matrix $A_{i,j}=(e_i,e_j). $
Claim: this matrix is invertible in $\mathbb{Z}/p\mathbb{Z}$ is a sufficient and necessary condition for "perfect".
Proof: assume the rows are linearly dependent in $\mathbb{Z}/p\mathbb{Z}$. Say there exists constants $c_1,\cdots, c_{2m+1}$, not all 0 such that $\sum c_jr_j=0$ where $r_j = (r_{j,1}, \cdots, r_{j,n})$. Then $(p^{N-1} \sum c_je_j, e_k)=0$ in $\mathbb{Z}/p^N\mathbb{Z}$ for all $k=1,\cdots,2m+1$
Work in $\mathbb{Z}/p^N\mathbb{Z}$ now
Claim: via an appropriate change of basis $(e_1,\cdots,e_{2m+1})$ to $(f_1,\cdots,f_{2m+1})$, I can get the matrix to be a diagonal matrix (and each cell on the diagonal is not a multiple of p since the matrix remains invertible) Proof: Consider a process where $e_1, \cdots, e_{2m+1}$ can change. Let $S=\{ 1,\cdots, 2m+1\}$. If for some $j\notin S$ and $(e_j,e_j)$ is not a multiple of p for some j, then I can change $e_k$ to $e_k - \frac{(e_k,e_j)}{(e_j,e_j)}$ for each $j\ne k$. Now $(e_j, e_k)=0$ for all $k\ne j$, and add $j$ to $S$. If $(e_j,e_j)$ is a multiple of $p$ for all $j\in S$, we find $k\in S$ such that $(e_j,e_k)$ is not a multiple of $p$ (if this is not possible then row $j$ is the zero vector in $\mathbb{Z}/p\mathbb{Z}$ but the rank of this matrix does not change as $(e_1,\cdots,e_{2m+1})$ remains a basis of $\Lambda$. Replace $e_j$ with $e_j+e_k$ and note $(e_j+e_k, e_j+e_k)=2(e_j,e_k)$ by symmetry, which is not a multiple of $p$. In this process, when any number $s$ is inserted to $S$ we have $(e_s,e_t)=0$ in $\mathbb{Z}/p^N\mathbb{Z}$ Therefore, the matrix is eventually diagonal. If $c_s=(e_s,e_s)$, if $x=\sum_{j=1}^{2m+1} x_je_j$ for some $x_j\in \mathbb{Z}/p^N\mathbb{Z}$ then $(x,x)=\sum_{j=1}^{2m+1} c_jx_j^2$
Let f(N) be the answer for N. Note that $f(0)=1, f(1)=p^{2m}$ can be proven via Gauss Sums.
The key observation is to note that among all $x_1,\cdots,x_{2m+1}$ when $p\mid \sum_{j=1}^{2m+1} c_jx_j^2$ and $p$ doesn't divide one of them, the residue of $\sum_{j=1}^{2m+1} c_jx_j^2$ mod $p^N$ takes on each multiple of $p$ the same number of times. Proof of key observation: let $j$ be the smallest number $j$ such that $p\nmid x_j$. Put in the group $\{ (x_1,\cdots,x_{j-1},x_j+kp,x_{j+1},\cdots, x_n) \mid k=0,\cdots,p^N-1 \}$. We can see that for any residue r mod $p^N$ that is a multiple of $p$, there are exactly $p$ k's that satisfy $T(k)=\sum_{1\le l \le 2m+1, l\ne j} c_lx_l^2 + c_j(x_j+kp)^2 \equiv r (\bmod\; p^N)$, because $T(a)=T(b)$ iff $p^{N-1}\mid a-b$.
We go back to computing $f(N)$. When $p$ divides $x_1,\cdots,x_{2m+1}$, we need $p^{N-2} \mid \sum c_k(x_k/p)^2$ where $x_k/p\in \mathbb{Z}/p^{N-1}\mathbb{Z}$. This gives $f(N-2) p^{2m+1}$ possibilities because for each of the $f(N-2)$ possibilities with each $x_j/p$ in $\{0,\cdots,p^{N-2}-1\}$ there are $p$ ways to add a multiple of $p^{N-2}$ to each $x_j/p$ When p doesn't divide one of $x_1,\cdots,x_{2m+1}$, then the number of $(x_1,\cdots,x_{2m+1})$ satisfying $p^N\mid \sum c_kx_k^2$ is $p^{-N+1}$ times the number of $(x_1,\cdots,x_{2m+1})$ satisfying $p\mid c_kx_k^2$. The latter can be found to be $p^{(2m+1)N-1}-p^{(2m+1)(N-1)}$
Therefore $f(N)=p^{2mN} - p^{2m(N-1)} + p^{2m+1} f(N-2)$. Via induction it is easy to prove that
$$f(2k) = p^{4km} + (p-1) \frac{p^{4km-1}-p^{(2m+1)k-1}}{p^{2m-1}-1}$$ $$f(2k+1) = p^{2m} ( p^{4km} + (p-1) \frac{p^{4km-1}-p^{(2m+1)k-1}}{p^{2m-1}-1})$$