We compare the results of experimental studies and numerical simulation of continuous-wave gyrotrons with operating frequencies in the range 250–315 GHz. A self-consistent calculation model of the gyrotron with a nonfixed structure of the high-frequency field is used to study the influence of the ohmic loss in the cavity, the velocity spread and space charge of the electron beam, the mode interaction, and reflection of waves from the output vacuum window on the gyrotron output characteristics. The obtained results allow one to optimize the cavity profile from the viewpoint of excitation of high-efficiency single-mode oscillations at the second gyrofrequency harmonic and estimate electron beam parameters in actual gyrotrons.