When the input voltage is logic 1 (5V) the p-channel MOSFET will not let the voltage to the output. But when the input voltage is 0 (0V) the p-channel MOSFET is sending the voltage to the output but the n-channel MOSFET is not letting the voltage to the ground so the output is logic 1 (5V)