In most cases, people do not place orders stating "I want to buy X at any price" or "I want to sell X at any price".
Instead, they place limit orders stating "I want to buy X for up to price Y", or "I want to sell X for at least price Y".
If the order matches a current opposite order, then it's fulfilled immediately. Otherwise, it gets added to the order book.
The order book is simply a list of current unfulfilled buy and sell orders. Something like:
30 @ 20.00
50 @ 19.90
10 @ 19.80
70 @ 19.50
10 @ 21.00
40 @ 21.20
20 @ 21.50
90 @ 22.00
As you can see, someone wants to sell 10 shares at $21 each. But the highest buying price is $20. So those orders remain on the order book until something changes.
The bid and ask prices you see are the "best" on each side ($20 and $21 in this example).
If nothing changes, then no sale happens. But at some point, someone will make a change. They may need to sell the stock urgently because they need the cash and are willing to get less money to sell right away. Or they want to sell the stock even at a "discount" because they think it's no longer worth its price and want to sell it before it goes down even further. Then they may place a sell order with a limit of $20, and then that sale gets fulfilled, and the latest trade (the "stock price" usually reported) is now $20.
Likewise, you may have someone who really wants to buy that stock because they think it's worth a lot more. So they may place a buy order with a limit of $21, and that gets fulfilled. The latest trade (again, the "stock price") would then become $21.
Here you can see a graphical representation of an order book varying over time:
Source: By Kjerish - Own work, CC BY-SA 4.0
Buy orders are in green, sell orders are in red.
My question is, who are these buyers and sellers
Anyone. Small private shareholders, very large pension funds, anything in between.
how are the prices determined as a function of these buyers and sellers?
Each buyer and seller determines the price they are wiling to buy or sell at based on whatever their own criteria are. If they don't match existing opposite orders, they go into the order book. If they match, a sale is made, and that becomes the new "stock price".
How is the supply and demand measured/used?
The size, shape and position of the order books.
I figure that the buyers and sellers cannot be regular people with stocks as they always buy at the ask price and sell at the bid price
For the sale to happen, yes, there needs to be a match, so technically, they do indeed "buy at the ask price and sell at the bid price". But anyone can place a limit order that will be at a price different from the current bid or ask price, and wait for it to be fulfilled (or not). In that case, there won't be a trade right away (or ever, if the prices are too far off).