Liquidity pools are protocols that pool together 2 or more tokens into a smart contract for the purpose of providing enough liquidity reserves for buyers and sellers to trade each token at the most efficient price possible.
For example, let's say a DEX features a liquidity pool (or LP) for trading ETH and DAI. Users who want to contribute funds to the pool would need to lock an equal amount of DAI and ETH into a smart contract (e.g 1 ETH and 3,000 DAI, or 2 ETH and 6,000 DAI at current prices).
If a buyer wants to purchase ETH from the liquidity pool, they can simply exchange the DAI they hold in their wallet for the available ETH in the pool.
The price of ETH and DAI are maintained by a pricing formula that takes into account the total supply of each token in the pool plus the natural arbitrage opportunity created when the price of either of the pools tokens fall out of line with their current price on centralized exchanges.
Users who provide liquidity are called ‘liquidity providers’ and are rewarded with a percentage of the fees that buyers and sellers pay for using the liquidity pool to trade tokens.
The fees are distributed proportionally to liquidity providers based on the amount of capital they contributed to the pool. Liquidity providers earn fees through LP tokens, which are tokens that represent their share of capital contributed to the pool.