How do stock prices work

What are the underlying principles of how stock prices are determined?