Well stocks are affected by supply and demand. If more people buy a stock then sell it the stock will go up. If more people sell the stock then buy it, the stock will go down.
So, any factor that people believe to impact the economy or a specific company will affect the price of the stock. Things like earnings, and government news related to the economy will affect the market in the short term.
Technical analysis which is simply the study of price movements will also affect the price of a stock in the short term.
In the long term fundamental analysis which is used to determine how strong a company is will ultimately triumph and push strong companies up and weak companies down.