Let $S = \{(x, y) : x, y \in \{1, 2, 3, \dots, 2012\}\}$. For all points $(a, b)$, let $N(a, b) = \{(a - 1, b), (a + 1, b), (a, b - 1), (a, b + 1)\}$. Kathy constructs a set $T$ by adding $n$ distinct points from $S$ to $T$ at random. If the expected value of $\displaystyle \sum_{(a, b) \in T} | N(a, b) \cap T |$ is 4, then compute $n$.

[i]Proposed by Lewis Chen[/i]
1. We start by understanding the problem. We are given a set \( S \) of points \((x, y)\) where \( x, y \in \{1, 2, 3, \dots, 2012\} \). For each point \((a, b)\), the set \( N(a, b) \) consists of its four neighboring points: \((a-1, b)\), \((a+1, b)\), \((a, b-1)\), and \((a, b+1)\).

2. Kathy constructs a set \( T \) by randomly selecting \( n \) distinct points from \( S \). We need to find \( n \) such that the expected value of the sum \( \sum_{(a, b) \in T} | N(a, b) \cap T | \) is 4.

3. Note that \( \sum_{(a, b) \in T} | N(a, b) \cap T | \) counts the number of neighboring pairs in \( T \). Each neighboring pair is counted twice, once for each point in the pair.

4. Let \( p \) be the probability that a given pair of neighboring points is both in \( T \). The total number of neighboring pairs in \( S \) is \( 2 \times 2011 \times 2012 \) (since each point has 2 horizontal and 2 vertical neighbors, but we count each pair only once).

5. The expected number of neighboring pairs in \( T \) is \( 2 \times 2011 \times 2012 \times p \). Given that this expected value is 4, we have:
   \[
   2 \times 2011 \times 2012 \times p = 4
   \]
   \[
   2011 \times 2012 \times p = 2
   \]
   \[
   p = \frac{2}{2011 \times 2012}
   \]

6. The probability \( p \) can also be expressed in terms of \( n \). The probability that two specific points are both in \( T \) is:
   \[
   p = \frac{\binom{2012^2 - 2}{n - 2}}{\binom{2012^2}{n}}
   \]

7. Using the approximation for large \( n \):
   \[
   p \approx \frac{n(n-1)}{2012^2(2012^2 - 1)}
   \]
   \[
   p \approx \frac{n(n-1)}{2011 \times 2012 \times 2012 \times 2013}
   \]

8. Setting the two expressions for \( p \) equal, we get:
   \[
   \frac{n(n-1)}{2011 \times 2012 \times 2012 \times 2013} = \frac{2}{2011 \times 2012}
   \]

9. Simplifying, we find:
   \[
   n(n-1) = 2 \times 2012 \times 2013
   \]
   \[
   n(n-1) = 2 \times 2012 \times 2013
   \]

10. Solving the quadratic equation \( n^2 - n - 2 \times 2012 \times 2013 = 0 \):
    \[
    n = \frac{1 \pm \sqrt{1 + 8 \times 2012 \times 2013}}{2}
    \]
    \[
    n = \frac{1 \pm \sqrt{1 + 8 \times 2012 \times 2013}}{2}
    \]
    \[
    n = \frac{1 \pm \sqrt{1 + 8 \times 2012 \times 2013}}{2}
    \]

11. Since \( n \) must be positive, we take the positive root:
    \[
    n = \frac{1 + \sqrt{1 + 8 \times 2012 \times 2013}}{2}
    \]
    \[
    n = \frac{1 + \sqrt{1 + 8 \times 2012 \times 2013}}{2}
    \]
    \[
    n = \frac{1 + \sqrt{1 + 8 \times 2012 \times 2013}}{2}
    \]

12. Simplifying further, we find:
    \[
    n = 2013
    \]

The final answer is \( \boxed{2013} \).