Market Microstructure: A Survey of Microfoundations, Empirical Results, and Policy Implications