AbstractIn this article, we develop novel mathematical models to optimize utilization of community energy storage (CES) by clustering prosumers and consumers into energy sharing communities/microgrids in the context of a smart city. Three different microgrid configurations are modeled using a unifying mixed‐integer linear programming formulation. These configurations represent three different business models, namely: the island model, the interconnected model, and the Energy Service Companies model. The proposed mathematical formulations determine the optimal households' aggregation as well as the location and sizing of CES. To overcome the computational challenges of treating operational decisions within a multi‐period decision making framework, we also propose a decomposition approach to accelerate the computational time needed to solve larger instances. We conduct a case study based on real power consumption, power generation, and location network data from Cambridge, MA. Our mathematical models and the underlying algorithmic framework can be used in operational and strategic planning studies on smart grids to incentivize the communitarian distributed renewable energy generation and to improve the self‐consumption and self‐sufficiency of the energy sharing community. The models are also targeted to policymakers of smart cities, utility companies, and Energy Service Companies as the proposed models support decision making on renewable energy related projects investments.