The probability of a matrix that is not full rank over the finite field can be calculated as follows. \begin{equation} \Pr\left(\text{rank}(\mathbf{G})<k\right)=\sum_{\mathbf{w}\in\mathbb{F}^k_p,\mathbf{w}\neq0}\Pr\left({\mathbf{G}\mathbf{w}=\mathbf{0}}\right)=\frac{p^k-1}{p^n} \end{equation} where $\mathbf{G}\in \mathbb{F}^{n\times k}_p$, $k<n$
But I don't know why $\sum_{\mathbf{w}\in\mathbb{F}^k_p,\mathbf{w}\neq0}\Pr\left({\mathbf{G}\mathbf{w}=\mathbf{0}}\right)=\frac{p^k-1}{p^n}$. Can anybody show me the reason?
For any fixed $\mathbf{w}$, a uniformly random matrix $\mathbf{G}$ will by definition be such that the vector $\mathbf{G}\mathbf{w}$ is uniformly distributed in $\mathbb{F}_p^n$. Therefore, the probability that it is equal to any fixed vector $\mathbf{v}\in \mathbb{F}_p^n$ (and, in particular, to the zero vector $\mathbf{0}_n$ is $1/|\mathbb{F}_p^n|=1/p^n$.
Therefore, $$ \sum_{\mathbf{w}\in\mathbb{F}_p^k\setminus \{\mathbf{0}_k\}} \mathbb{P}\{\mathbf{G}\mathbf{w}=\mathbf{0}\} = \sum_{\mathbf{w}\in\mathbb{F}_p^k\setminus \{\mathbf{0}_k\}} \frac{1}{p^n} = \frac{p^k-1}{p^n} $$ as claimed, since $\lvert \mathbb{F}_p^k\setminus \{\mathbf{0}_k\}\rvert = p^k -1$.