A field effect transistor can be used as a nonlinear element for the resonant detection of incident terahertz (THz) radiation at room temperature. The excitation of the plasma modes in the channel significantly increases the detection efficiency in the THz range. By means of a numerical hydrodynamic model, we study the drain-current response of a high electron mobility transistor to a THz signal applied on its gate and/or on its drain contacts to obtain the optimal configuration in terms of detection. We demonstrate that the amplitudes of the harmonic and average drain-current responses associated with the presence of plasma modes in the channel strongly depend on which transistor terminal collects the incident THz radiation and that a maximum dcresponse can be obtained by appropriately dephasing the two electrode signals.