Carbocations and radicals are stabilized through hyperconjugation. Alkyl groups donate electron density to adjacent electron-deficient p-orbitals, and as a result tertiary carbocations and radicals are more stable than secondary or primary.
How does hyperconjugation in a carbocation work? A carbocation, by definition, has an empty p-orbital. When carbocations have neighboring groups, the sigma bonds of those neighboring groups can donate electron density to the carbocation because electrons are attracted to spaces that have a deficiency of electrons. The neighboring bond can be a C-H bond or a C-C bond. Let’s visualize this phenomenon using ethyl carbocation:
Side-note: remember that electrons are not point-objects; they’re closer to clouds of probability that, like a gas, can change their volume depending on the size of their container. The empty p-orbital essentially acts as an extension to the container of the C-H bond electrons. This is a gross oversimplification, but it should help visualize it :)
In this case, the carbocation’s empty p-orbital and the sigma bond from the adjacent C-H bond are overlapping. This allows electron density to be distributed across both carbons and the hydrogens, which results in greater stability because the charge is more distributed. When the sigma bond is donating electron density, it’s partially rehybridizing from sp3 to sp2. It might be helpful to think about this as a partial self-elimination reaction. Let’s look at the kinda complicated resonance structures of the terminal propylium carbocation:
Okay, let’s break this down a bit. These are resonance contributors, but remember that molecules don’t oscillate between resonance forms; they exist as a resonance hybrid. That means that the bonds to hydrogen are actually still intact. This is just showing how the C-H bond’s electrons can be used to make a partial pi-bond to the carbocation in a resonance hybrid that resembles propene.
It’s no secret that understanding this concept in detail is not the easiest thing to do, but there’s good news! In undergraduate O-Chem, we really just need to understand the stability trends that result from it. But wait a second… what’s likely to be observed when we have a primary carbocation? Rearrangement!
Now that we’ve got a secondary carbocation, the same kind of electron delocalization through hyperconjugation results in even more atoms supporting the positive charge. Here’s what the resonance hybrid looks like for the secondary propylium cation
Carbon is more electronegative than hydrogen. That means that carbons pull electron density away from hydrogen in a slightly polar bond. Electron-deficient carbons, like carbocations, are stabilized by neighboring carbons that in turn steal electron density from their attached hydrogens. This is one of the explanations of the carbocation stability trend, but it seems that the hyperconjugation argument holds more water.
P.S. Radicals are also stabilized by hyperconjugation, so their stability trend follows the carbocation stability trend. They don’t, however, rearrange the way that carbocations do. In fact, most undergraduate Organic Chemistry courses strictly say that they don’t rearrange; you’re stuck with whatever radical is generated.