P2SH
Also called: Pay to Script Hash, pay-to-script-hash, 3 address, P2SH address, redeem script, nested SegWit, P2SH-P2WPKH.
P2SH (Pay to Script Hash), defined in BIP 16, locks bitcoin to the hash of a script. Its addresses start with 3, and it carried most early multisig.
P2SH, Pay to Script Hash, lets a sender pay to a short hash of a script instead of the script itself. The receiver reveals the full script, called the redeemScript, only when spending. P2SH addresses start with 3.
How it works
BIP 16, by Gavin Andresen, defines the output script:
OP_HASH160 <20-byte script hash> OP_EQUAL
To spend, the scriptSig provides the signatures (or other data) followed by the serialized redeemScript. Nodes check that the script hashes to the stored value, then run it against the remaining data. BIP 13 defines the address: Base58Check with version byte 5 on mainnet (a leading 3) and 196 on testnet (a leading 2). The P2SH rules were enforced from April 2012 as a soft fork.
Why it mattered
Before P2SH, a sender had to put a long multisig script into their own transaction and pay for its size. BIP 16 moved that cost and complexity to the receiver: any policy, however complicated, fits behind a fixed 20-byte hash that is easy to paste or scan as a QR code. P2SH became the standard home for multisig (see BIP 45 and BIP 67), limited to 15 compressed keys because the redeemScript must fit in 520 bytes.
Nested SegWit
P2SH can also wrap a SegWit program. P2SH-P2WPKH and P2SH-P2WSH (BIP 141) gave older wallets a 3... address they could pay, while the receiver still got SegWit savings. BIP 49 defines the m/49' path and ypub keys for wrapped single-key wallets. Native SegWit addresses are cheaper to spend, but P2SH remains valid everywhere. More in the address types guide.