Can someone please explain to me how stock prices go up and down? What are the underlying physical and information technology phenomena and algorithms that drive a stock up or down?
This question may be better on the personal finance or the economics site, but I will answer it here. The question is very difficult because no one thing causes it. There is also a very different solution to the question if you are asking about the immediate future versus a long period of time as the factors are different.
In the short-run, if you look at the mechanics of a trade, there are two main broad categories of orders and in the United States, two types of markets. The two order types are market orders and limit orders. The two market types are auction markets and dealer markets. Both of these sentences are overgeneralizations. The NYSE does not work the way the now defunct Arizona exchange worked. Fill-or-kill orders do not work the way a market order for a single round lot works.
The key element of equity market orders is that until an offer is made, the short-run supply curve and the demand curve do not intersect. The existence of a bid-ask spread implies the curves are non-intersecting in the immediate period. For an order to be filled, the immediate curve has to be shifted. Of course, the true short-run curves includes as yet unseen supply and demand. I may be willing to pay \$50 per share for IBM but may not have placed my order yet. I might be eating lunch. The immediate demand curve cannot include my order, but the short-run curve, at least in theory, does.
Market makers and specialists keep a supply of cash and shares on hand to cover market orders in the event no other party has an outstanding market order that would cover the transaction. The bid-ask spread is their compensation for carrying the inventory risk. As an example, imagine a bid price of 49.50 and an ask of 49.75. You buy shares at market for 49.75. The bid and ask change to 49.600 and 50.00. Someone else wants to sell, so they ask 49.60 for the shares. The market maker pays 49.60 and recovers their inventory that they had sold to you, pocketing the fifteen cents.
When someone places a market order, it drains the liquidity of the market maker or specialist by taking away their inventory of cash or shares. A market order allows a filling of shares, pretty much on demand, but the price is set by the dealer if there is no outstanding limit order to cover it. For larger orders, a market order is an order to continue bidding any amount of money to guarantee you are the high bidder as a buyer or the low bidder as a seller in order to be certain that your order will be filled, no matter what.
Limit orders state the prices that can be paid by a broker in order for you to buy or sell shares. If I am willing to sell at \$50, then I cannot receive less than \$50 (gross of commissions). I can receive more. If I am willing to pay \$12.50 per share, then I will not have to pay more than \$12.50 per share before commissions. If there is no offer inside my limits, then my order will never be filled.
For market orders, the price is driven by the bidding process. Market orders will keep bidding higher and higher or lower and lower until the order is filled. For limit orders, which provide liquidity to the market makers, those limits set the pricing for the market makers as they can use those orders to fill their obligations. People who state the prices publicly are the ones who decide what the price will be. In exchange for setting a limit order, the brokers are obligated to get the best price available for the maker of those limit orders. So if I say I will pay \$12.50, but a broker can get it for me at \$11.40, then I will get it at $11.40.
Now there is one more wrinkle in the short-run. When you look at a chart or trades on a ticker, that is not the actual order in which they happened. That is the order in which they were reported. Large orders would disrupt the market, so they are only reported as a weighted average of the trade prices and only after that order would no longer have a disruptive effect on the price. So if there is an order to buy 10,000 shares and everyone knew that people might make really high limit orders to make it hard to fill the big order and others might glom on to buy knowing the price will be driven up by the large order. So if you see a price change, it might not reflect the true current price structure. The bid-ask spread does, but the immediate spread does not appear on the charts and isn't recorded for most of US history.
In the long run, prices are driven by large macroeconomic forces. If you have a choice of eating or buying shares, you will choose to eat. This means that stock market money is always leftover money. It is money above your consumption needs. In addition, other assets compete for your money, such as bonds and bank accounts. As such, if someone will pay enough to borrow money, stocks cannot give a lower return as they make no promises about future cash flows.
Furthermore, stocks are countercyclical. There is more free money during an economic expansion than a recession. So stock prices are the worst when people need money the most, and the best when they least need it. Bonds are procyclical. When the economy is doing poorly, people seek the safety of bonds. Also, of importance, inflation falls as there is no demand for money, comparatively and so bonds become of greater value. Likewise, to stimulate the economy interest rates fall, so the present value of bonds rises.
In the very long term, dividends follow inflation on a lagged basis, and prices move with corporate productivity. Improvements in productivity that persist have a long impact on prices. In the very long term, inflation and persisting interest rates impact prices. In the very long term, demographic factors matter. In the US, baby boomers are retiring and selling their shares to live off the money. There are fewer young people, fewer even now that immigrants are being deported. If foreigners are willing to pick up the slack, the price will rise. If native borns need even more shares to be sold, then prices will fall. Finally, taxes have a complicated relationship with stocks. Low tax levels are bad in the long run. High tax levels are bad in the long run. That is because levels of taxation reflect the public expenditure on infrastructures like roads or law enforcement. The disaster that was Kansas' tax structure is a great example. Kansas destroyed its economy with tax rates that were unsustainably low. So did Greece. On the other hand, during the Cold War tax rates were very high, at the margin, but didn't always buy useful public goods.
There is also a difference between auction markets and dealer markets. In auction markets, buyers bid against other buyers for the right to buy while sellers bid against other sellers for the right to sell. These are high volume markets and so price swings tend to be smaller because there is a greater level of competition and more observable orders that permits easier price discovery. Dealer markets are more like retail stores. All trades are with dealers and no trades are with other individuals. Dealers set the prices, though competitively against other dealers.
As the dealers are covering the markets out of their own pockets, the liquidity costs are higher, so the spreads are wider. This makes markets look more volatile even when they are basically flat and moving sideways. In dealer markets, ever trade is wider.
There are tons of algorithms in place, but there isn't just one. If you would look at my trades as an "algorithm", it wouldn't look like another investor's algorithm. I use long run valuation rules. A day trader uses a minute-by-minute or second-by-second time horizon. We are not using the same thinking and we do not have the same goals. There are thousands of separate algorithms in place.