  Given a polynomial $Q(x_1,\cdots, x_t)=\lambda_1 x_1^{k_1}+\cdots +\lambda_t
x_t^{k_t}$, for every $c\in \mathbb{Z}$ and $n\geq 2$, we study the number of
solutions $N_J(Q;c,n)$ of the congruence equation $Q(x_1,\cdots, x_t)\equiv
c\bmod{n}$ in $(\mathbb{Z}/n\mathbb{Z})^t$ such that $x_i\in
(\mathbb{Z}/n\mathbb{Z})^\times$ for $i\in J\subseteq I= \{1,\cdots, t\}$. We
deduce formulas and an algorithm to study $N_J(Q; c,p^a)$ for $p$ any prime
number and $a\geq 1$ any integer. As consequences of our main results, we
completely solve: the counting problem of $Q(x_i)=\sum\limits_{i\in I}\lambda_i
x_i$ for any prime $p$ and any subset $J$ of $I$; the counting problem of
$Q(x_i)=\sum\limits_{i\in I}\lambda_i x^2_i$ in the case $t=2$ for any $p$ and
$J$, and the case $t$ general for any $p$ and $J$ satisfying
$\min\{v_p(\lambda_i)\mid i\in I\}=\min\{v_p(\lambda_i)\mid i\in J\}$; the
counting problem of $Q(x_i)=\sum\limits_{i\in I}\lambda_i x^k_i$ in the case
$t=2$ for any $p\nmid k$ and any $J$, and in the case $t$ general for any
$p\nmid k$ and $J$ satisfying $\min\{v_p(\lambda_i)\mid i\in
I\}=\min\{v_p(\lambda_i)\mid i\in J\}$.
