Pay-to-Script-Hash (P2SH) is a type of transaction which allows for the spending of bitcoin based on the satisfaction of any script provided by the sender.
For example, if Alice sends Bob 1 BTC in a P2SH transaction, she includes the hash of the script required to spend the bitcoin in the transaction. This script can require signatures by Bob’s private keys and/or many other qualifications. When Bob wants to spend the bitcoin he has received from Alice, he reconstructs the script Alice has provided him, and signs the transaction with any private keys required by the script.
P2SH is extremely flexible because it allows users to construct arbitrary scripts. P2SH is used to enable backwards compatibility with new transaction types, including SegWit.