  Free electrons are unique tools to probe and manipulate nanoscale optical
fields with emerging applications in ultrafast spectromicroscopy and quantum
metrology. However, advances in this field are hindered by the small
probability associated with the excitation of single optical modes by
individual free electrons. Here, we theoretically investigate the scaling
properties of the electron-driven excitation probability for a wide variety of
optical modes including plasmons in metallic nanostructures and Mie resonances
in dielectric cavities, spanning a broad spectral range that extends from the
ultraviolet to the infrared. The highest probabilities for the direct
generation of three-dimensionally confined modes are observed at low electron
and mode energies in small structures, with order-unity ($\sim100$\%) coupling
demanding the use of $<100$~eV electrons interacting with $<1$~eV polaritons
confined down to tens of nm. Electronic transitions in artificial atoms also
emerge as practical systems to realize strong coupling to few-eV free
electrons. In contrast, conventional dielectric cavities reach a maximum
probability in the few-percent range. In addition, we show that waveguide modes
can be generated with higher-than-unity efficiency by phase-matched interaction
with grazing electrons, suggesting an efficient method to create multiple
excitations of a localized optical mode by an individual electron through
funneling the so-generated propagating photons into a confining cavity -- an
alternative approach to direct electron-cavity interaction. Our work provides a
roadmap to optimize electron-photon coupling with potential applications in
electron spectromicroscopy as well as nonlinear and quantum optics at the
nanoscale.
