Here's my understanding, starting with some background terminology:

Everything that's tradable on an exchange (an "instrument") has a bid/ask spread that represents the highest price someone's willing to pay to buy (the bid), and the lowest price that someone's willing to pay to sell (the ask). There is _always_ a bid/ask spread, because as soon as anyone places an order that would reduce the spread to zero, that means they're willing to pay what someone's asking, or vice-versa, and therefore the exchange immediately converts it into a trade--done deal!--and now there's a spread again. Incidentally, executing a trade this way is "crossing the spread", you're opting to "pay the difference" between the bid and ask to get your trade done.

Someone that crosses the spread is said to be "taking liquidity." They're willing to pay the surcharge of the bid/ask spread to get their trade executed right now. On the other hand, someone that sits at the bid/ask spread, waiting for someone to cross to execute, is said to be "offering liquidity," they're willing to patiently wait in order to save money equal to the spread.

Now, a market maker is a participant that is _solely_ interested in making money off that bid/ask spread, basically like a sports bookie. They're willing to always be in the market, on both sides, and take the spread whenever someone crosses over. So if say AMZN is trading at 3332.95 x 3333.05, they'll be offering to buy at 3332.95, and sell at 3333.05, and any time people take those offers, they make a dime. Do this thousands of times a day, on many different instruments, and you've got a business. That said, there's real risks in market making, and understanding them requires the idea of "informed" versus "uninformed" trading.

An uninformed trader comes to the market simply because they want to trade for some external goal unrelated to trading. Maybe they're selling stock for a house downpayment, or buying agricultural futures because they make potato chips and don't want to deal with the price shocks of a sudden drought. They're willing to cross the spread, and they don't particularly care if they lose a few pennies on the transaction, because that's not their goal. These traders are the meat and potatoes for market makers, because they don't move the fundamental price of the instrument, they're effectively noise. In a market of nothing but uninformed traders, you would expect your position as a market maker to fluctuate around zero, because you're buying roughly as much as you're selling.

An informed trader, on the other hand, "knows something". They're aware of some material fact (or at least a strong hypothesis) that indicates the price of the instrument is going to move dramatically in the near future. They're willing to cross the spread, because they know the spread is going to move with them anyway. These are danger for market makers, because they will all pile in on one side of the trade, all buying, or all selling, and now the market maker will end up in a losing position--short when the price is going up, or long when the price is going down.

Imagine running a Gamestop store: on a normal day, you might see half your customers buying a PS4 and half selling a PS4, but on the day that the PS5 is announced, suddenly everyone wants to sell their PS4 at the same time before you lower what you're offering.

The classic market maker algorithm looks at "inventory", basically your absolute outstanding position, and tries to keep inventory as low as possible. When uninformed trading is taking place, your inventory is around zero, and you can stay very close to the minimum spread. As your inventory grows, and you become either increasingly more long or short, you start pulling your bids or asks away from the best bid/ask to try and bias future trades back into a 50/50 ratio. All market makers doing this simultaneously means the bid/ask spread starts to widen as there's increased uncertainty about the price.

Another key element to market making comes down to trade volumes. You could, today, start market making, all you need to do is put in limit orders at the bid and ask and wait. However, you'd probably not make that much, because you're losing money to various trading commissions, exchange fees, roundtrip network latency, etc. Professional market makers make tens of thousands of automated trades in a day, and as a result, are able to negotiate substantially lower costs that make it worth doing. Many exchanges even have "designated market makers" that have special trading permissions in exchange for guaranteeing that they will _always_ provide some best bid/ask offer even in the worst case conditions, otherwise you in a sufficiently large event you could get a "liquidity crisis" (i.e. there's no one willing to buy or sell that instrument at any price).

That ended up being more text than I thought it would--apologies.