How stocks are priced on the stock exchange

What mechanisms ensure fair pricing on stock exchanges?