Let $n\geq2$ be a positive integer, with divisors $1=d_1<d_2<\,\ldots<d_k=n$.  Prove that $d_1d_2+d_2d_3+\,\ldots\,+d_{k-1}d_k$ is always less than $n^2$, and determine when it is a divisor of $n^2$.
1. **Define the sum \( S \):**
   Let \( S = d_1d_2 + d_2d_3 + \cdots + d_{k-1}d_k \).

2. **Express \( S \) in terms of \( n \):**
   We can write:
   \[
   S = n^2 \left( \frac{d_1d_2}{n^2} + \frac{d_2d_3}{n^2} + \cdots + \frac{d_{k-1}d_k}{n^2} \right)
   \]

3. **Estimate the sum of fractions:**
   Notice that:
   \[
   \frac{d_1d_2}{n^2} + \frac{d_2d_3}{n^2} + \cdots + \frac{d_{k-1}d_k}{n^2} \leq \left( \frac{1}{d_1} - \frac{1}{d_2} \right) + \left( \frac{1}{d_2} - \frac{1}{d_3} \right) + \cdots + \left( \frac{1}{d_{k-1}} - \frac{1}{d_k} \right)
   \]
   This telescoping series simplifies to:
   \[
   \left( \frac{1}{d_1} - \frac{1}{d_k} \right) = 1 - \frac{1}{n}
   \]

4. **Bound \( S \):**
   Therefore, we have:
   \[
   S \leq n^2 \left( 1 - \frac{1}{n} \right) = n^2 - n
   \]
   Since \( n \geq 2 \), it follows that:
   \[
   n^2 - n < n^2
   \]
   Hence, \( S < n^2 \).

5. **Determine when \( S \) is a divisor of \( n^2 \):**
   Suppose \( S \mid n^2 \). Any divisor of \( n^2 \) can be written as a product of two divisors of \( n \). Let \( S = d_a d_b \) where \( b > a \).

6. **Use the smoothing lemma:**
   **Lemma:** If \( 0 < x \leq z \leq y \), then \( xy < xz + zy \).

   **Proof:** Over the interval \([x, y]\), the extrema of the linear function \( z(x + y) \) will be at the edges, so:
   \[
   x^2 + xy \leq xz + zy \leq y^2 + xy
   \]
   Therefore, \( xy < xz + zy \). \(\blacksquare\)

7. **Apply the lemma:**
   Suppose \( b - a \leq 2 \). Using the lemma, we see that:
   \[
   d_a d_b < d_a d_{a+1} + d_{a+1} d_{a+2} + \cdots + d_{b-1} d_b
   \]
   Thus, \( d_a d_b < S \).

8. **Consider the case \( b - a = 1 \):**
   If \( b - a = 1 \), then the only way \( S = d_a d_{a+1} \) is if \( n \) has only two factors, meaning \( n \) is prime. For a prime \( n \), \( S = 1 \cdot p \mid p^2 \).

9. **Conclusion:**
   Therefore, the answer is \( \boxed{n \text{ is prime}} \).