Determine all positive integers $n$ for which there exists a positive integer $d$ with the property that $n$ is divisible by $d$ and $n^2+d^2$ is divisible by $d^2n+1$.
To determine all positive integers \( n \) for which there exists a positive integer \( d \) such that \( n \) is divisible by \( d \) and \( n^2 + d^2 \) is divisible by \( d^2 n + 1 \), we start by analyzing the given conditions.

1. **Given Conditions:**
   \[
   d \mid n \quad \text{and} \quad d^2 n + 1 \mid n^2 + d^2
   \]

2. **Express \( n \) in terms of \( d \):**
   Since \( d \mid n \), let \( n = kd \) for some positive integer \( k \).

3. **Substitute \( n = kd \) into the divisibility condition:**
   \[
   d^2 (kd) + 1 \mid (kd)^2 + d^2
   \]
   Simplifying, we get:
   \[
   d^3 k + 1 \mid k^2 d^2 + d^2
   \]

4. **Factor out \( d^2 \) from the right-hand side:**
   \[
   d^3 k + 1 \mid d^2 (k^2 + 1)
   \]

5. **Rewrite the divisibility condition:**
   \[
   d^3 k + 1 \mid d^2 (k^2 + 1) - (d^3 k + 1) (k)
   \]
   Simplifying the right-hand side:
   \[
   d^2 (k^2 + 1) - k (d^3 k + 1) = d^2 k^2 + d^2 - d^3 k^2 - k = d^2 - k
   \]
   Therefore:
   \[
   d^3 k + 1 \mid d^2 - k
   \]

6. **Analyze the divisibility condition:**
   \[
   d^3 k + 1 \mid d^2 - k
   \]
   This implies that \( d^3 k + 1 \leq d^2 - k \).

7. **Case Analysis:**
   - **Case 1: \( k < d^3 \)**
     \[
     d^3 k + 1 \leq d^2 - k
     \]
     Rearranging:
     \[
     k (d^3 + 1) \leq d^2 - 1
     \]
     \[
     k \leq \frac{d^2 - 1}{d^3 + 1}
     \]
     Since \( k \) is a positive integer, this inequality must hold. However, for \( d \geq 2 \), the right-hand side is less than 1, which is not possible for positive \( k \).

   - **Case 2: \( k > d^3 \)**
     \[
     d^3 k + 1 \leq d^2 - k
     \]
     Rearranging:
     \[
     k (d^3 + 1) \leq d^2 - 1
     \]
     \[
     k \leq \frac{d^2 - 1}{d^3 + 1}
     \]
     This is the same inequality as in Case 1, leading to the same contradiction.

8. **Conclusion:**
   The only possible case is when \( k = d \). Substituting \( k = d \) into \( n = kd \), we get:
   \[
   n = d^2
   \]
   Verify:
   \[
   d^2 n + 1 = d^4 + 1
   \]
   \[
   n^2 + d^2 = d^4 + d^2
   \]
   Clearly, \( d^4 + 1 \mid d^4 + d^2 \).

Thus, the only solution is \( n = d^2 \).

The final answer is \( \boxed{ n = d^2 } \).