Fifth-generation energy networks are combined networks of heat and electricity, that have the ability to generate, distribute, store and share energy between consumers. Knowledge on the dynamic behaviour of the physical phenomena related to energy generation, distribution and storage provides insight into the performance of the system as a whole. A mixed-integer linear algorithm is proposed, implementing a partitioned clustering program for subsequent classification of typical demand, grouping specific days with similar demand profiles together. From this arrangement, the optimal network configuration can be determined using an objective function, minimizing the economic and environmental impact. To validate the optimization results, a simulation of the network was built, which mimics its physical dynamic behaviour, and through which the distribution and storage capabilities of the network can be assessed. Advanced advice on fifth-generation energy networks is presented that can be applied to early-stage network design, reducing costs and emissions, along with data on the implementation of renewable energy technologies and their performance. Additionally, this research provides the foundation for numerical modelling of such energy networks which contributes to future research.