Although the full electronic structure of an arene can only be computed using quantum mechanics, the directing effects of different substituents can often be guessed through analysis of resonance diagrams.  Specifically, any formal negative or positive charges in minor resonance contributors (ones in accord with the natural polarization but not necessarily obeying the octet rule) reflect locations having a larger or smaller density of charge in the molecular orbital for a bond most likely to break. A carbon atom with a larger coefficient will be preferentially attacked, due to more favorable orbital overlap with the electrophile.  
The perturbation of a conjugating electron-withdrawing or electron-donating group causes the π electron distribution on a benzene ring to resemble (very slightly!) an electron-deficient benzyl cation or electron-excessive benzyl anion, respectively.  The latter species admit tractable quantum calculation using Hückel theory: the cation withdraws electron density at the ortho and para positions, favoring meta attack, whereas the anion releases electron density into the same positions, activating them for attack.  This is precisely the result that the drawing of resonance structures would predict.  
For example, aniline has resonance structures with negative charges around the ring system:
Attack occurs at ortho and para positions, because the (partial) formal negative charges at these positions indicate a local electron excess.  On the other hand, the nitrobenzene resonance structures have positive charges around the ring system:
Attack occurs at the meta position, since the (partial) formal positive charges at the ortho and para positions indicate electron deficiency at these positions.  
Another common argument, which makes identical predictions, considers the stabilization or destabilization by substituents of the Wheland intermediates resulting from electrophilic attack at the ortho/para or meta  positions.  The Hammond postulate then dictates that the relative transition state energies will reflect the differences in the ground state energies of the Wheland intermediates.