Let $p$ be a prime number, and let $n$ be a positive integer. Find the number of quadruples $(a_1, a_2, a_3, a_4)$ with $a_i\in \{0, 1, \ldots, p^n - 1\}$ for $i = 1, 2, 3, 4$, such that \[p^n \mid (a_1a_2 + a_3a_4 + 1).\]
1. **Identify the problem and given conditions:**
   We need to find the number of quadruples \((a_1, a_2, a_3, a_4)\) such that \(a_i \in \{0, 1, \ldots, p^n - 1\}\) for \(i = 1, 2, 3, 4\) and \(p^n \mid (a_1a_2 + a_3a_4 + 1)\).

2. **Define the set and the condition:**
   Let \(S = \{0, 1, \ldots, p^n - 1\}\). We need to count the number of quadruples \((a_1, a_2, a_3, a_4) \in S^4\) such that \(p^n \mid (a_1a_2 + a_3a_4 + 1)\).

3. **Consider the divisibility condition:**
   The condition \(p^n \mid (a_1a_2 + a_3a_4 + 1)\) can be rewritten as:
   \[
   a_1a_2 + a_3a_4 \equiv -1 \pmod{p^n}
   \]

4. **Classify pairs \((a_1, a_2)\) and \((a_3, a_4)\):**
   We need to consider pairs \((a_1, a_2)\) and \((a_3, a_4)\) such that their product modulo \(p^n\) satisfies the given condition.

5. **Count the number of valid pairs:**
   - For each pair \((a_1, a_2)\), we need to find pairs \((a_3, a_4)\) such that \(a_3a_4 \equiv -1 - a_1a_2 \pmod{p^n}\).
   - Fix \(a_1\) and \(a_2\). There are \(p^n\) choices for each, so there are \(p^{2n}\) pairs \((a_1, a_2)\).

6. **Determine the number of solutions for \((a_3, a_4)\):**
   - For each fixed \((a_1, a_2)\), the equation \(a_3a_4 \equiv -1 - a_1a_2 \pmod{p^n}\) must be satisfied.
   - For a fixed \(a_3\), there is a unique \(a_4\) that satisfies the equation because \(a_3\) has an inverse modulo \(p^n\) (since \(p\) is prime and \(a_3 \neq 0\)).

7. **Count the total number of quadruples:**
   - For each of the \(p^{2n}\) pairs \((a_1, a_2)\), there are \(p^n\) valid pairs \((a_3, a_4)\).
   - Therefore, the total number of quadruples \((a_1, a_2, a_3, a_4)\) is:
   \[
   p^{2n} \times p^n = p^{3n}
   \]

The final answer is \(\boxed{p^{3n}}\).