A liquidity pool is a shared fund, usually made up of two tokens (for example ETH and USDC), that a smart contract uses to let any user swap between those two assets without needing a matched buyer and seller at that exact moment.
How you earn money by providing liquidity
Every time someone swaps tokens using the pool, they pay a small fee that's distributed proportionally among everyone who has provided liquidity, based on their share of the total pool. In exchange for your contribution you receive "LP tokens" (liquidity provider tokens), a receipt representing your share of the pool that you can redeem at any time for your proportional share of both assets.
The main risk: impermanent loss
When the relative price of the pool's two tokens changes, the contract itself automatically rebalances your funds, which can generate impermanent loss compared with simply holding the tokens in your wallet. You need to weigh that potential loss against the fees earned to know whether providing liquidity was worthwhile.
Concentrated pools
In newer versions of DEXs (such as Uniswap v3), you can concentrate your liquidity within a specific price range instead of covering the entire possible range, which increases the fees earned within that range, but also the risk if the price moves outside it.