Let $p$ be a prime number. How many solutions does the congruence $x^2+y^2+z^2+1\equiv 0\pmod{p}$ have among the modulo $p$ remainder classes?

[i]Proposed by: Zoltán Gyenes, Budapest[/i]
To solve the problem, we need to determine the number of solutions to the congruence \(x^2 + y^2 + z^2 + 1 \equiv 0 \pmod{p}\) for a prime number \(p\). We will use the notation \(\mathcal{N}(a, n)\) to denote the number of solutions to \(x_1^2 + x_2^2 + \cdots + x_n^2 \equiv a \pmod{p}\).

1. **Base Case and Induction Hypothesis:**
   We start by considering the base case for \(n = 2\). The number of solutions to \(x^2 + y^2 \equiv a \pmod{p}\) is given by:
   \[
   \mathcal{N}(a, 2) = p + (-1)^{\frac{p+1}{2}}
   \]
   This result comes from the fact that the number of solutions to \(x^2 + y^2 \equiv a \pmod{p}\) depends on whether \(a\) is a quadratic residue modulo \(p\).

2. **Recursive Formula:**
   We claim that the number of solutions \(\mathcal{N}(a, n)\) for \(n \geq 2\) can be expressed recursively as:
   \[
   \mathcal{N}(a, n) = p^{n-2} \left(p + (-1)^{\frac{p+1}{2}}\right) + p(-1)^{\frac{p-1}{2}} \mathcal{N}(a, n-2)
   \]
   This formula is derived by considering the sum over all possible values of \(x_{n-1}\) and \(x_n\) and splitting the sum into cases where \(x_{n-1}^2 + x_n^2 \equiv b \pmod{p}\) for different values of \(b\).

3. **Summation and Induction:**
   By induction on \(n\), we can show that:
   \[
   \sum_{b} \mathcal{N}(b, n-2) = p^{n-2}
   \]
   This is because the total number of solutions to \(x_1^2 + x_2^2 + \cdots + x_{n-2}^2 \equiv b \pmod{p}\) summed over all \(b\) must account for all possible combinations of \(x_1, x_2, \ldots, x_{n-2}\).

4. **Plugging in Values:**
   To find the number of solutions to \(x^2 + y^2 + z^2 + 1 \equiv 0 \pmod{p}\), we set \(a = p-1\) and \(n = 3\) in our recursive formula:
   \[
   \mathcal{N}(p-1, 3) = p^{3-2} \left(p + (-1)^{\frac{p+1}{2}}\right) + p(-1)^{\frac{p-1}{2}} \mathcal{N}(p-1, 1)
   \]
   Since \(\mathcal{N}(p-1, 1)\) is the number of solutions to \(x^2 \equiv p-1 \pmod{p}\), which is 0 because \(p-1\) is not a quadratic residue modulo \(p\), we have:
   \[
   \mathcal{N}(p-1, 3) = p \left(p + (-1)^{\frac{p+1}{2}}\right)
   \]

Conclusion:
\[
\boxed{p \left(p + (-1)^{\frac{p+1}{2}}\right)}
\]