Microgrids usually employ distributed energy resources such as wind turbines, solar photovoltaic modules, etc. When multiple distributed generation resources with different features are used in microgrids, managing these resources becomes an important problem. The generated power of solar photovoltaic modules and wind turbines used in microgrids is constantly changing with solar irradiation and wind speed. Due to this impermanent and uncertain nature of renewable energy resources, generally, energy storage systems are employed in microgrid systems. To control the distributed energy resources and energy storage units and sustain the supply and demand balance within the microgrid and provide sustainable and reliable energy to the loads, energy management systems are used. Many methods are used to realize and optimize energy management in microgrids. This review article provides a comparative and critical analysis of the energy management systems used in microgrids. The energy management system can be tailored for different purposes, which are also discussed in detail. Additionally, various uncertainty measurement methods are summarized to manage the variability and intermittency of renewable energy sources and load demand. Finally, some thoughts about potential future directions and practical applications are given.