Each square of an $n \times n$ grid is coloured either blue or red, where $n$ is a positive integer. There are $k$ blue cells in the grid. Pat adds the sum of the squares of the numbers of blue cells in each row to the sum of the squares of the numbers of blue cells in each column to form $S_B$. He then performs the same calculation on the red cells to compute $S_R$.
If $S_B-  S_R = 50$, determine (with proof) all possible values of $k$.
1. Let \( b_i \) be the number of blue cells in the \( i \)-th row. Then, the total number of blue cells in the grid is given by:
   \[
   b_1 + b_2 + \dots + b_n = k
   \]
   The number of red cells in the \( i \)-th row is \( n - b_i \).

2. The sum of the squares of the number of blue cells in each row is:
   \[
   \sum_{i=1}^n b_i^2
   \]
   The sum of the squares of the number of red cells in each row is:
   \[
   \sum_{i=1}^n (n - b_i)^2
   \]

3. We need to compute the difference between these sums:
   \[
   \sum_{i=1}^n b_i^2 - \sum_{i=1}^n (n - b_i)^2
   \]

4. Expanding the second sum:
   \[
   \sum_{i=1}^n (n - b_i)^2 = \sum_{i=1}^n (n^2 - 2nb_i + b_i^2)
   \]
   \[
   = \sum_{i=1}^n n^2 - 2n \sum_{i=1}^n b_i + \sum_{i=1}^n b_i^2
   \]
   \[
   = n^3 - 2nk + \sum_{i=1}^n b_i^2
   \]

5. Therefore, the difference is:
   \[
   \sum_{i=1}^n b_i^2 - (n^3 - 2nk + \sum_{i=1}^n b_i^2) = 2nk - n^3
   \]

6. Similarly, for the columns, let \( c_j \) be the number of blue cells in the \( j \)-th column. The same calculation applies, giving:
   \[
   \sum_{j=1}^n c_j^2 - \sum_{j=1}^n (n - c_j)^2 = 2nk - n^3
   \]

7. Thus, the total difference \( S_B - S_R \) is:
   \[
   S_B - S_R = 2(2nk - n^3) = 4nk - 2n^3
   \]

8. Given \( S_B - S_R = 50 \), we have:
   \[
   4nk - 2n^3 = 50
   \]
   \[
   2nk - n^3 = 25
   \]
   \[
   n(2k - n^2) = 25
   \]

9. Since \( n \) is a positive integer, \( n \) must be a divisor of 25. The divisors of 25 are 1, 5, and 25.

10. For each possible \( n \):
    - If \( n = 1 \):
      \[
      1(2k - 1^2) = 25 \implies 2k - 1 = 25 \implies 2k = 26 \implies k = 13
      \]
      However, \( k \) must be less than \( n^2 \), so \( k < 1 \), which is not possible.

    - If \( n = 5 \):
      \[
      5(2k - 25) = 25 \implies 2k - 25 = 5 \implies 2k = 30 \implies k = 15
      \]
      Here, \( k = 15 \) and \( k < 25 \), which is valid.

    - If \( n = 25 \):
      \[
      25(2k - 625) = 25 \implies 2k - 625 = 1 \implies 2k = 626 \implies k = 313
      \]
      Here, \( k = 313 \) and \( k < 625 \), which is valid.

11. Therefore, the possible values of \( k \) are 15 and 313.

The final answer is \( \boxed{15} \) and \( \boxed{313} \).