I have read in textbooks that the kinetic energy of an ejected electron in the photoelectric effect depends on the frequency of the incident photon. My question is, how exactly is the electrons' kinetic energy measured while doing the experiment?
You can measure the kinetic energy of the ejected electrons by applying an electric field pushing back the electrons to the metal.
Look at the experimental apparatus shown at Photoelectric effect. It provides also the explanation how to measure the kinetic energy of the electrons:
Schematic of experimental apparatus to demonstrate the photoelectric effect. The filter passes light of certain wavelengths from the lamp at left. The light strikes the curved electrode, and electrons are emitted. The adjustable voltage can be increased until the current stops flowing. This "stopping voltage" is a function only of the electrode material and the frequency of the incident light, and is not affected by the intensity of the light.
The energy $eV_S$ by this so-called "stopping voltage" $V_S$ (measured as described above) just neutralizes the kinetic energy of an electron, thus bringing the flying electrons to a halt.