By means of a numerical hydrodynamic model, we consider the mechanism of collective plasma oscillations in a field-effect transistor channel under different excitations and biasing conditions. First, we consider the case of a device externally-excited by a harmonic optical beating or an electronic excitation under constant current condition at the drain. Both situations exhibit sharp resonances related to the first odd plasma modes illustrating the possibility of using the HEMT as a terahertz photomixer or detector. Then, we demonstrate that the frequencies, amplitudes and quality factors of the resonances can be strongly modified by varying the drain biasing condition from current-to voltage-driven operation.