Let's do a quick review of MOSFET operation.
An P type MOSFET in depletion mode, apply a positive voltage enough to
create a wide neutral zone and it turns off by the action of holes at
the base drawing electrons to it.
An N type MOSFET in depletion mode, connected to ground, a reservoir of
electrons, and they start to push electrons on the other side of the
gate away, as if connected to a negative voltage, creating a zone where
the material loses its negative charge via the lost electrons, and it
turns off.
As you can see, only one of the types of MOSFET is active in a certain
configuration: Positive turns the P type OFF and the N type ON, and
ground will turn P type ON and the N type OFF.
This interesting characteristic is employed in the making of digital
circuits, that work with ON (1) and OFF (0) values only, and the fact
that ON is represented by an almost direct connection to a positive rail
and 0 is an almost direct connection to the ground rail.
A very simple circuit demonstrates it, called an inverter. Imagine one P
type MOSFET's source connected to positive and sink to the source of a N
type MOSFET. Also, the sink of the N type is connected to ground.
Both MOSFETs share the same base connection, and the output will be taken at the P sink/N source connection.
When we connect the base to the positive rail, the P type MOSFET will
turn off, insulating the output from the positive rail its source is
connected to, but the N type MOSFET will be fully on, effectively
connecting the output to the ground rail. An ON (1) input gives an OFF
(0) output, in other words, the input is inverted.
On the other hand, if we connect the shared base connection to ground,
the P type transistor will be fully ON, connecting the output to the
positive rail, and the N type will be fully OFF, insulating it from the
ground rail. An OFF (0) input gives an ON (1) output, again, the input
is inverted.
Many more combinations of this two complementary MOSFETs are possible,
creating any kind of digital circuit you can imagine, like all of the
microprocessors used to build computers and cell phones.