How many transistors are there in a logic gate?

See the first answer to this question. It shows a TTL inverter circuit with a totem-pole output; there are four transistors. A TTL NAND gate would also have four transistors, but the input side would have a dual-emitter transistor.

An unbuffered CMOS inverter has just two transistors, yes, but a buffered inverter will have more (either four or six, I can't remember which, or perhaps it varies).

If you are making gates out of discrete transistors, diodes and resistors, you can make an inverter with one transistor, a NAND with two transistors, or with diodes.

If it is in a integrated circuit, where a resistor is more complex to make than a transistor, more transistors are used either for polarisation (for example ni old NMOS), or now as part of more complex circuits with complementary logic such as CMOS. A basic CMOS inverter uses 2 transistors. Inputs can be added by using transistors with several gate contacts.

It works when that gate is one among many others, driving a few similar gates. For large fan-out gates, or when these gates are sold as components, like a 7400 or a HC4000, there are additional transistors, with different geometries for conditioning the input, multiply the output current rating.