What is the K-Nearest Neighbors (KNN) algorithm and how does it work in machine learning? How does KNN classify data points based on their neighbors? What factors influence the performance of KNN, such as the value of K and distance metrics? How is KNN applied in real-world tasks like classification and regression? What are the advantages and limitations of using KNN compared to other machine learning algorithms?