Ok,
For Leaving Groups:
For either Sn1, Sn2, E1, or E2:
Let's say "LG" is the leaving group.
In any of those 4 reactions, the LG is taking electrons along with it. In the transition state (TS), the LG becomes partially negative. The group that can stabilize the TS best is the one that will have a lower Activation energy (and thus a faster reaction).
The atoms/compounds that can stabilize that extra negative charge are those that can DELOCALIZE and HOLD/PULL that negative charge. Delocalization comes in two flavors (RESONANCE and SIZE OF THE ANION). Now obviously, no one ever heard of resonance during the TS, but it helps lower the TS.
HOLDING/PULLING negative charge towards the nucleus (positive charge) doesn't allow the electrons to leave and go back to the Carbon that it's leaving the electrons with. Therefore the HIGHER the ELECTRONEGATIVITY (EN-) of the LG, the better it is as a LG. Also, the higher EN- of the LG, the more positive the carbon becomes, making it "hotter" for a Nucleophile to attack it.
So, for DELOCALIZATION, the more RESONANCE (like in COO-, OTs, OTf, etc) the more stable that negative charge is, therefore the better LG (for TS and product). Also, notice how the atoms holding that negative charge is a very EN- atom (Oxygen), thereby making them even better leaving groups.
Also, the SIZE of the anion allows for that extra negative charge to be spread out all over the anion (electrons aren't static), therefore in ANY SOLVENT, I- > Br- > Cl- > F- (notice that EN- is practically negligible). HOWEVER, everyone knows that radius of atom DECREASES across a period (F is smaller than O). That size difference is negligible, and EN- wins out.
Also, larger atoms like I have a longer bond distance to C (a smaller atom). This larger distance (compared to F) makes it easier to break the bond. Usually atoms with similar size (like C and F) make stronger bonds.
So BIGGER ANION, MORE RESONANCE, AND MORE EN- tend to produce best LEAVING GROUPS
The same reasoning applies to Bases. The best Acids are those that have the BEST LG's.
Quick note on solvents...if the solution is POLAR PROTIC, F- LG is OK, b/c it'll be stabilized via Hydrogen bonds. However, that stabilization is still way lower than the delocalization of electrons in a big atom.
NUCEOPHILICITY
First off, Nucleophiles (Nu) are different from Bases, however good Bases tend to be good Nu.
A GOOD BASE is opposite of a good LG. So, smaller anion size (F- > Cl- > Br- > I-), minimal resonance, low EN- (C- > N- > O- > F-). So it's solely based on how much NEGATIVE CHARGE is on the anion.
Therefore a BULKY BASE (with a many alkyl groups that donate e- to anion) is a better BASE (taking away Hydrogen only)...t-butyl oxide > methoxide (OCH3) > OH-
The opposite trend makes the better Nu (OH- > -OCH3 > -O(CH3)3
This is true for any solvent.
Now, about the halogens.
There are two factors: SOLVENT AND POLARIZABILITY
SOLVENT:
POLAR PROTIC VS. POLAR APROTIC
POLAR PROTIC solvents will surround smaller anions best, therefore making F- a weaker nucleophile than I-. The partial positive Hydrogen makes hydrogen bonds with anions that have a more "concentrated" negative charge. In bigger anions, the charge is dispersed so it's harder to interact.
Therefore, in Polar Protic Solvents,
I- > Br- > Cl - > F-
In POLAR APROTIC Solvents, ALL Nucleophiles become stronger because there's no solvation (nothing to stop it from attacking) because no H-bonds form. However, this time, I- is not that much stronger than F-.
In polar aprotic solvents, the trend is not that clear-cut. The trend may even be opposite.
Another BIG FACTOR is POLARIZABILITY. Larger elements have larger, more diffuse, and more polarizable electron clouds. These electron clouds allow for more effective orbital overlap in the SN2 TS. Therefore, lower TS energy and thus a faster reaction.
The 5p orbital of Iodine is easily able to distort it's electron cloud TOWARDS the electropositive sp3 hybridized Carbon atom. The less polarizable 2p orbital of flourine cannot interact as well.
Some of the stuff was taken from Vollhardt/Schore textbook.
Hope this helped 😀