We analyze the functioning and performance of electricity markets, both on the generation and the retailing side. We develop electricity market models that allow us to understand how firms or consumers behave depending on the market rules or the competitive environment.