For which positive integers $n$, one can find real numbers $x_1,x_2,\cdots ,x_n$ such that $$\dfrac{x_1^2+x_2^2+\cdots+x_n^2}{\left(x_1+2x_2+\cdots+nx_n\right)^2}=\dfrac{27}{4n(n+1)(2n+1)}$$ and $i\leq x_i\leq 2i$ for all $i=1,2,\cdots ,n$ ?
1. We start with the given equation:
   \[
   \frac{x_1^2 + x_2^2 + \cdots + x_n^2}{(x_1 + 2x_2 + \cdots + nx_n)^2} = \frac{27}{4n(n+1)(2n+1)}
   \]
   and the condition \(i \leq x_i \leq 2i\) for all \(i = 1, 2, \ldots, n\).

2. We know the sum of squares of the first \(n\) positive integers:
   \[
   1^2 + 2^2 + \cdots + n^2 = \frac{n(n+1)(2n+1)}{6}
   \]
   Therefore,
   \[
   \frac{27}{4n(n+1)(2n+1)} = \frac{9}{8 \left(1^2 + 2^2 + \cdots + n^2\right)}
   \]

3. We need to prove:
   \[
   \frac{x_1^2 + x_2^2 + \cdots + x_n^2}{(x_1 + 2x_2 + \cdots + nx_n)^2} \leq \frac{9}{8 \left(1^2 + 2^2 + \cdots + n^2\right)}
   \]
   This is equivalent to:
   \[
   8(x_1^2 + x_2^2 + \cdots + x_n^2) \left(1^2 + 2^2 + \cdots + n^2\right) \leq 9(x_1 + 2x_2 + \cdots + nx_n)^2
   \]

4. Given \(i \leq x_i \leq 2i\), we have:
   \[
   (x_i - i)(2i - x_i) \geq 0 \Rightarrow 3ix_i \geq x_i^2 + 2i^2
   \]

5. Therefore:
   \[
   (3x_1 + 6x_2 + \cdots + 3nx_n)^2 \geq \left(x_1^2 + x_2^2 + \cdots + x_n^2 + 2(1^2 + 2^2 + \cdots + n^2)\right)^2
   \]

6. Let \(A = x_1^2 + x_2^2 + \cdots + x_n^2\) and \(B = 1^2 + 2^2 + \cdots + n^2\). We need to prove:
   \[
   8AB \leq (A + 2B)^2
   \]
   This simplifies to:
   \[
   (A - 2B)^2 \geq 0
   \]
   which is always true.

7. For equality to hold, we must have \(x_i = i\) or \(x_i = 2i\) for all \(i = 1, 2, \ldots, n\). This implies:
   \[
   x_1^2 + x_2^2 + \cdots + x_n^2 = 2(1^2 + 2^2 + \cdots + n^2)
   \]

8. We also have:
   \[
   3(x_1 + 2x_2 + \cdots + nx_n) = 4(1^2 + 2^2 + \cdots + n^2)
   \]
   This implies:
   \[
   3 \mid 4(1^2 + 2^2 + \cdots + n^2) \Rightarrow 3 \mid 1^2 + 2^2 + \cdots + n^2
   \]

9. Since:
   \[
   1^2 + 2^2 + \cdots + n^2 = \frac{n(n+1)(2n+1)}{6}
   \]
   we need:
   \[
   9 \mid n(n+1)(2n+1)
   \]

10. Analyzing the divisibility:
    - If \(n \equiv 0 \pmod{3}\), then \(9 \mid n\), so \(n \equiv 0 \pmod{9}\).
    - If \(n \equiv 1 \pmod{3}\), then \(9 \mid 2n + 1\), so \(n \equiv 4 \pmod{9}\).
    - If \(n \equiv 2 \pmod{3}\), then \(9 \mid n + 1\), so \(n \equiv 8 \pmod{9}\).

Thus, we conclude that \(n \equiv 0, 4, 8 \pmod{9}\).

The final answer is \( \boxed{ n \equiv 0, 4, 8 \pmod{9} } \).