How do the exchanges actually work?

Hello, I am curious as to how the exchanges actually match buyers and sellers of equities and determine a corresponding price. For example, when I put in my sell order for a stock using my discount brokerage account, does the system just log the quantity of shares for sale and my ask price and wait for someone to put in a similar buy order? Or do my shares simply flow into a holding pool until someone else decides that they want to buy at my ask price? Also, what factors affect the price of a stock? I know it will be a product of supply versus demand but how does the system determine a price? At what exact moment does the trading system determine that there are “X” number of shares waiting to be sold at “X” amount and there are fewer or more people willing to buy at the same price. Then how does it determine how much the price should go up or down depending on the level of supply and demand? Is this why share prices are generally displayed with a 15 min delay? How does it calculate real time trading data and adjust? I’d appreciate some insight regarding these questions, thanks in advance.

The system doesn’t determine prices, people do. Here I’m selling at 45.20 does that work for you? 45.00?! Bite Me! How about 45.15? Okay done. Book it. Last traded price = 45.15.

http://www.amazon.com/Trading-Exchanges-Market-Microstructure-Practitioners/dp/0195144708/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1201627151&sr=1-1

That book appears to be exactly what I was looking for, thanks!