Electricity generation using distributed renewable energy systems is becoming increasingly common due to the significant increase in energy demand and the high operation of conventional power systems with fossil fuels. The introduction of distributed renewable energy systems in the electric grid is crucial for delivering future zero-emissions energy systems and is cost-effective for promoting and facilitating large-scale generation for prosumers. However, these deployments are forcing changes in traditional energy markets, with growing attention given to transactive energy networks that enable energy trading between prosumers and consumers for more significant benefits in the cluster mode. This change raises operational and market challenges. In recent years, extensive research has been conducted on developing different local energy market models that enable energy trading and provide the opportunity to minimize the operational costs of the distributed energy resources by promoting localized market management. Local energy markets provide a stepping stone toward fully transactive energy systems that bring adequate flexibility by reducing users’ demand and reflecting the energy price in the grid. Designing a stable regulatory framework for local electricity markets is one of the major concerns in the electricity market regulation policies for the efficient and reliable delivery of electric power, maximizing social welfare, and decreasing electric infrastructure expenditure. This depends on the changing needs of the power system, objectives, and constraints. Generally, the optimal design of the local market requires both short-term efficiencies in the optimal operation of the distributed energy resources and long-term efficiency investment for high quality. In this paper, a comprehensive literature review of the main layers of microgrids is introduced, highlighting the role of the market layer. Critical aspects of the energy market are systematically presented and discussed, including market design, market mechanism, market player, and pricing mechanism. We also intend to investigate the role and application of distributed ledger technologies in energy trading. In the end, we illuminate the mathematical foundation of objective functions, optimization approaches, and constraints in the energy market, along with a brief overview of the solver tools to formulate and solve the optimization problem.