WOW, thats a question with many answers.
Internal and external factors determine a companys stock price.
Internal- is the company growing/have they appointed new management/are they making profit
external-political,eg new alcohol laws may see companies involved in alcohol, profits fall.
The weather can affect the markets, eg hurricane katrinia hit the gulf of mexico a few years back, this stopped oil production for days, affecting the oil companies.
There are hundreds, if not thousands of things that can affect the price.
Get into a company which is consitent in profit and has growth and you should profit.
Do some research on fundemental analysis, this should also help you understand a bit better.
hope this helps