Written x times y equals k, where x and y are the two reserves. A swap adds to one side and removes from the other such that the product is unchanged, which makes the marginal price simply y divided by x. Fees are taken before the calculation, so k creeps upward over time and that growth is what pays liquidity providers.
The shape matters more than the algebra. Because the curve is a hyperbola, the pool can never be fully drained at any price, and the cost of each additional unit rises steeply. Small trades relative to the pool get near-mid prices; large ones get progressively worse.
Example: a pool holds 100 ETH and 300,000 USDC, so k is 30,000,000 and the price is 3,000. Buying 10 ETH leaves 90 ETH, so USDC must rise to 333,333, meaning you pay 33,333 for 10 ETH, an average of 3,333 and about 11% price-impact. The same 10 ETH from a pool ten times larger costs roughly 1% more than mid.
Related: amm, price-impact, liquidity-pool, concentrated-liquidity