Stub 101 Here's how it works.
A 1/4 wave shorting stub consist of a short piece of transmission line with a "T" configuration. The length of the "T" is determined by the frequency of operation in a fixed frequency stub or a length of line capable of tuning the entire band for a frequency agile stub. IE: FM Band 88-108 the line length is 36 inches.
Let's first look at a fixed frequency stub. The RF from the transmitter, in the case of a transmitting stub, enters the stub where it hits the "T" and travels +90 degrees to the short at the end. At the short the RF is reflected back +180 degrees out of phase and then travels back up the line another +90 degrees to meet the incoming RF in phase.
A 1/4 wave short is an RF open and a 1/4 wave open is an RF short.
The frequency agile stub simply put has a brass slug secured by set screws that allows it to be moved up and down the length of the "T" through a slot to tune the unit to your frequency. If you purchase a frequency agile stub it can change frequencies easily. Some minor VSWR issues can be resolved by field tuning a frequency agile stub.
Should lightning hit your tower, it does not have to hit your antenna directly, we will cover that later, the high voltage pulse travels down your transmission line and meets the stub where it is shorted to ground without ever developing any hazardous voltages. MOSFETS populate most modern transmitters amplifiers and they are great at doing what they are designed to do, amplify your signal. MOSFETS are however not forgiving about voltage spikes and since most amplifier have some MOSFETS connected directly to your output connector they are at risk from even a small voltage spike. There are times that MOSFETS will fail days or weeks later after a pulse from a lightning strike.
Now about why lightning does not have to hit your antenna directly. DC grounded antennas help mitigate lightning damage as well as proper grounding, these things however do not solve all potential problems. When lightning hits a tower, the tower and everything connected to it charge up and discharge very quickly. The quicker the better but that depends on the ground system at the base of the tower. When the tower and everything attached to it discharge a pulse is induced into transmission lines to the center conductor like the secondary of an ignition coil. This pulse is the damage causing part of a non direct lightning strike.
I have had customers with very expensive transmitters get direct hits that caused catastrophic damage to their antennas but did not touch the transmitter. Switch to the backup antenna and your back on the air.
A 1/4 wave shorting stub is simply the ultimate in coaxial lightning protection. Nothing else even comes close!