Q:

Why do ANOVA contrast tests use N - k degrees of freedom?

I would have thought that the degrees of freedom would be the same as a regular t-test, i.e. N - 1, since in a contrast we are either comparing two groups, or two sets of groups. Why do we instead use the within SS degrees of freedom (N - k)?
Here are some example SPSS tables from http://wiki.uva.nl/spss/index.php/One-way_ANOVA

A:

In a regular t-test, you lose one degree of freedom from having to estimate a single mean while estimating $\sigma$.  In ANOVA, you lose $k$ degrees of freedom from having to estimate $k$ means while estimating the common $\sigma$.  Though you are only comparing two groups in the contrast, you are using the pooled estimate of $\sigma$, which is why you still lose $k$ df.    

A:

Degrees of freedom in these situations are based off the number of degrees of freedom in the error term (to estimate the standard error of the noise term). These are based on residuals, for which $N$ observations have been used to estimate $k$ means, each one costing one degree of freedom.
That means that there are $N-k$ d.f. in the error term which is used for the comparisons in the contrasts.

