The rapid evolution of wireless communication technologies, along with the increasing demand for efficient and reliable data transfer, has driven the rethinking of traditional cellular network architectures in the context of next-generation networks. In conventional cellular systems, communication between users typically occurs through base stations. However, to improve efficiency, scalability, and spectral utilization, device-to-device (D2D) communication has been introduced, enabling direct data transmission between users without base station involvement. In this paper, we present a comprehensive review of D2D communication from architectural and challenges perspective for future generation networks. Additionally, the study focuses on relay-assisted D2D (RAD2D) communication, examining the role of machine learning (ML) and artificial intelligence (AI) in optimizing relay selection processes. In light of the existing literature, challenges for implementing RAD2D are discussed from different perspectives such as relay selection, energy efficiency, secure communication, resource allocation, and the management of dynamic network conditions