Liquidity pools use algorithms called Automated Market Makers (AMM) to provide constant liquidity for trading.
A single liquidity pool holds a pair of tokens and each pool creates a new market for that particular pair of tokens. The first depositor to the pool or liquidity provider sets the initial price of assets in the pool. Liquidity providers are incentivized to supply an equal value of both tokens to the pool. They receive special tokens called LP token in proportion to their contribution to the pool. When a trade occurs, a 0.3% fee is collected and distributed proportionally to all LP token holders.
When a token swap occurs through a pool, the supply of an asset decreases while the other increases. Therefore, price changes occur that are adjusted by an algorithm called an automated market maker (AMM).
This is the time where liquidity pools play their best role as they do not need a professional, centralized market maker to manage the prices of assets. Liquidity providers simply deposit their assets into the pool and the smart contract takes care of the pricing.