Let $(x_n)$, $n=1,2, \ldots $ be a sequence defined by $x_1=2008$ and
\begin{align*} x_1 +x_2 + \ldots + x_{n-1} = \left( n^2-1 \right) x_n \qquad ~ ~ ~ \forall n \geq 2 \end{align*}
Let the sequence $a_n=x_n + \frac{1}{n} S_n$, $n=1,2,3, \ldots $ where $S_n$ $=$ $x_1+x_2 +\ldots +x_n$. Determine the values of $n$ for which the terms of the sequence $a_n$ are perfect squares of an integer.
1. **Base Case Verification:**
   We start by verifying the base case for \( n = 1 \). Given \( x_1 = 2008 \), the base case holds true.

2. **Inductive Hypothesis:**
   Assume that for \( n = 1, 2, \ldots, k-1 \), the sequence \( x_n \) is given by:
   \[
   x_n = \frac{4016}{n(n+1)}
   \]

3. **Inductive Step:**
   We need to show that \( x_k = \frac{4016}{k(k+1)} \). Using the given recurrence relation:
   \[
   x_1 + x_2 + \ldots + x_{k-1} = (k^2 - 1) x_k
   \]
   By the inductive hypothesis:
   \[
   \sum_{i=1}^{k-1} x_i = \sum_{i=1}^{k-1} \frac{4016}{i(i+1)}
   \]
   This sum can be simplified using partial fractions:
   \[
   \frac{4016}{i(i+1)} = 4016 \left( \frac{1}{i} - \frac{1}{i+1} \right)
   \]
   Therefore:
   \[
   \sum_{i=1}^{k-1} \frac{4016}{i(i+1)} = 4016 \sum_{i=1}^{k-1} \left( \frac{1}{i} - \frac{1}{i+1} \right)
   \]
   This is a telescoping series, so:
   \[
   4016 \left( 1 - \frac{1}{k} \right) = 4016 \left( \frac{k-1}{k} \right)
   \]
   Thus:
   \[
   x_k = \frac{\sum_{i=1}^{k-1} x_i}{k^2 - 1} = \frac{4016 \left( \frac{k-1}{k} \right)}{k^2 - 1} = \frac{4016}{k(k+1)}
   \]
   This completes the inductive step.

4. **Sequence \( S_n \):**
   Given \( S_n = x_1 + x_2 + \ldots + x_n \), we have:
   \[
   S_n = \sum_{i=1}^n \frac{4016}{i(i+1)} = 4016 \sum_{i=1}^n \left( \frac{1}{i} - \frac{1}{i+1} \right) = 4016 \left( 1 - \frac{1}{n+1} \right) = 4016 \left( \frac{n}{n+1} \right)
   \]

5. **Sequence \( a_n \):**
   The sequence \( a_n \) is defined as:
   \[
   a_n = x_n + \frac{1}{n} S_n
   \]
   Substituting \( x_n \) and \( S_n \):
   \[
   a_n = \frac{4016}{n(n+1)} + \frac{1}{n} \cdot 4016 \left( \frac{n}{n+1} \right) = \frac{4016}{n(n+1)} + \frac{4016}{n+1} = \frac{4016}{n}
   \]

6. **Perfect Squares:**
   We need \( a_n = \frac{4016}{n} \) to be a perfect square. Since \( 4016 = 16 \times 251 \), we have:
   \[
   \frac{4016}{n} = k^2 \implies n = \frac{4016}{k^2}
   \]
   For \( n \) to be an integer, \( k^2 \) must be a divisor of 4016. The divisors of 4016 are \( 1, 16, 251, 4016 \), corresponding to \( k = 1, 4, \sqrt{251}, \sqrt{4016} \). Only \( k = 1 \) and \( k = 4 \) are integers, giving:
   \[
   n = 4016, 251, 1004
   \]

The final answer is \( \boxed{ n = 251, 1004, 4016 } \)