A Comprehensive Review of Recommender Systems: Transitioning from Theory to Practice