A very important concept when it comes to thinking about markets in economics is the idea of Pareto efficiency. An allocation of resources is Pareto efficient if it is not possible to make anyone better off without making someone else worse off.
For example, imagine that you and a friend are deciding how to split a savory pizza at dinner time. You’re so hungry that you’d like to eat the whole pizza by yourself, but in the interest of fairness you both decide that you should each get half of the pizza. Is this a Pareto efficient allocation of pizza? Yes! The only way to make one of you better off - the only way that one person can have more pizza - is to make the other person worse off - by taking away a slice from their half of the pizza (pretend that there is no other pizza available at the time).
Consider another example: instead of splitting the pizza in half, imagine that you only got one slice and your friend gets the entire remaining pizza. This doesn’t seem fair to you - but is this a Pareto efficient allocation? Also yes! Again, there is no way to give you more pizza without taking some pizza away from your friend, which means that the distribution of pizza is Pareto efficient, even though it might not seem very fair.
The point is not that Pareto efficient is the best allocation, but rather that once you get to a Pareto efficient allocation you have to start making some people worse off in order to make other people better off. This involves tradeoffs, or giving up something valuable (your own pizza) in order to get something else which is also valuable (your friend’s pizza). In other words, if an allocation is Pareto efficient it means that no Pareto improvements are possible. A Pareto improvement is a change in the allocation of resources so that at least one person is better off and nobody else is worse off. In both of the examples above, the allocations are Pareto efficient since there is no way to give someone more pizza without taking away pizza from the other person.
Most economists - and most non-economists too - would agree that we should at least get to Pareto efficient outcomes, even if people disagree about what’s fair or how to change resource allocations once we get there. Why wouldn’t you make someone better off if it didn’t make anyone else worse off? Not getting to a Pareto efficient outcome would be like leaving a slice of pizza in the box and throwing it away, even though either one of you would be happy to eat it. Wasting a slice of pizza is not a Pareto efficient allocation. That’s because a Pareto improvement is possible in this case - we can make one person better off by giving them the last slice, and you don’t have to take away anyone else’s pizza to do it!
The hard part is deciding what changes in the allocation of resources ought to be made in order to make the allocation fairer or more equal, even if some people are made worse off. Should you get more of the pizza if you paid more for it? What if your friend is hungrier than you because they haven’t been able to eat all day? What if it’s your friend’s birthday and it’s their favorite type of pizza? When applied to splitting a pizza, these may seem like trivial questions, but for many economic issues - like what a “fair” tax rate is or how much should be spent on school funding - these issues are often very contentious.
In perfectly competitive market, the equilibrium price and quantity are Pareto efficient. This is part of why economists, in general, tend to like free markets for most goods with competition - we know that they are at least Pareto efficient! And we should make sure we aren’t wasting resources (e.g. throwing away pizza for no reason). Of course, this doesn’t mean free markets are always fair. Just as in the 2nd example above, a Pareto efficient outcome may not necessarily be fair to everyone involved. But the concept of Pareto efficiency, and making sure that we take advantage of Pareto improvements, is a powerful concept that is used throughout academic economics.