Why does nucleophilic aromatic substitution occur at C-2 and C-4 of pyridine?
Nucleophilic aromatic substitution on pyridines (or related heterocycles such as quinolines or pyrimidines) regioselectively occurs at the 2- and 4- positions. These can be thought of as being "ortho" or "para" to the nitrogen.

In the mechanism for nucleophilic aromatic substitution, the initial step involves attack of the nucleophile (in this case, methoxide anion) on the π-system of the aromatic ring. Because this step generates a high-energy anionic intermediate which has its aromaticity broken, it is also typically the rate-determining step. In general, the stability of this intermediate is what dictates whether a nucleophilic aromatic substitution is possible or not.

If we consider the resonance forms for this intermediate resulting from attack at each of the three positions, we can understand why attack at C-2 and C-4 is favoured.



When the nucleophile attacks at C-2 or C-4, the resultant intermediate possesses one resonance form where the negative formal charge is located on nitrogen. On the other hand, this is not possible when the nucleophile attacks at C-3.

In general, resonance forms involving negative charges on electronegative atoms such as N and O are much more important contributors than resonance forms with negative charges on carbon. Thus, the anionic intermediate resulting from attack at C-2 or C-4 is better stabilised by resonance, allowing the nucleophilic substitution to take place.