Carbon nanotube transistors have outstanding potential for electronic detection of biomolecules in solution. The physical mechanism underlying sensing however remains controversial, which hampers full exploitation of these promising nanosensors. Previously suggested mechanisms are electrostatic gating, changes in gate coupling, carrier mobility changes, and Schottky barrier effects. We argue that each mechanism has its characteristic effect on the liquid gate potential dependence of the device conductance. By studying both the electron and hole conduction, the sensing mechanisms can be unambiguously identified. From extensive protein-adsorption experiments on such devices, we find that electrostatic gating and Schottky barrier effects are the two relevant mechanisms, with electrostatic gating being most reproducible. If the contact region is passivated, sensing is shown to be dominated by electrostatic gating, which demonstrates that the sensitive part of a nanotube transistor is not limited to the contact region, as previously suggested. Such a layout provides a reliable platform for biosensing with nanotubes.