Power systems around the world are being modernized to address environmental concerns, reduce costs, and guarantee access to electricity all the time. Four main criteria for this upgrade are efficiency, reliability, resiliency, and sustainability. Recent advances in various technologies are the key enablers for this modernization. Nevertheless, such physical systems are becoming overwhelmingly large-scale and stochastic with highly complex dynamics, coupled with millions of human interactions. The operation of these systems needs disruptive changes in data processing mechanisms (such as learning), in real-time decision-making processes (such as optimization and control), in electricity markets, and in policies and regulations. This course provides a fundamental understanding of the operation of power system and discusses the pathway to the modernization of power grids. In particular, the role of optimization, control and machine learning in future energy systems will be discussed thoroughly.