SN2 and E2 reactions share a number of similarities. Both require good leaving groups, and both mechanisms are concerted. SN2 reactions require a good nucleophile and E2 reactions require a strong base. However, a good nucleophile is often a strong base. Since the two reactions share many of the same conditions, they often compete with each other. The the outcome of the competition is determined by three factors: the presence of antiperiplanar β-hydrogens, the degree of α and β branching, and the nucleophilicity vs. basicity of the reactant species.
In order for an E2 elimination to occur, there must be antiperiplanar β-hydrogens to eliminate. If there are none, the SN2 reaction will dominate. On the same token, the SN2 nucleophile needs an free path to the σ* C-LG antibond. α and β branching block this path and reduce the proportion of SN2 relative to E2. E2 occurs even with extensive branching because it relies on the β-hydrogens, which are much more accessible than the σ* C-LG antibond.
The identity of the nucleophile or base also determines which mechanism is favored. E2 reactions require strong bases. SN2 reactions require good nucleophiles. Therefore a good nucleophile that is a weak base will favor SN2 while a weak nucleophile that is a strong base will favor E2. Bulky nucleophiles have a hard time getting to the α-carbon, and thus increase the proportion of E2 to SN2. Polar, aprotic solvents increase nucleophilicity, and thus increase the rate of SN2.