A substitution reaction follows a fairly simple form: one group simply substitutes for another in the reaction, as shown here. Whether or not it follows the second-order mechanism depends on certain factors.
Two mechanisms are actually possible for substitution, the SN1 mechanism, and the SN2 mechanism (shown in the next figure). Both involve substituting one group on a molecule for another. If you think of these substitution reactions in relationship terms, the SN2 mechanism is analogous to dumping your current significant other and immediately starting a relationship with a new romantic partner. The SN1 mechanism is analogous to breaking up with your current significant other, staying single for a while, and only after you've been single, becoming attached to a new romantic partner.
So how do you know which mechanism will occur for a given substitution reaction? The answer, unfortunately, is, "It depends." It depends on the solvent, the nature of the substrate, and the substituting group (called the nucleophile, or nucleus lover, sometimes abbreviated Nuc). To figure out which mechanism will occur, you need to see the details of each mechanism.
The mechanism for the SN2 reaction is shown in the next figure. This reaction is called the substitution nucleophilic bimolecular reaction, which, thankfully, is called SN2 for short. The SN2 reaction occurs in a single step: A nucleophile (Lewis base) attacks a carbon that's attached to an electronegative leaving group (labeled X), and gives the leaving group the boot, taking its place.
Why does the nucleophile attack the carbon? One way to think of this reaction is in terms of the attraction between opposite charges. The carbon-leaving group bond (C-X) is polarized; that is, the electronegative leaving group pulls electron density away from the carbon to which it's attached, leaving the carbon with a partially positive charge, as shown here.
Therefore, the molecule that contains the leaving group (called the substrate) acts as an electrophile (an electron lover). Nucleophiles (electron-rich species that love nuclei) attack the partially positive carbon, in part due to the electrostatic attraction between the two nuclei.
If you understand nucleophile-electrophile attraction in this way, you can understand many, many organic reactions. The basic templates for these reactions are the same: Some electron-rich atom (a nucleophile) attacks an electron-poor atom (an electrophile). The details change, but that's pretty much the gist of it.