Sentiment analysis is a natural language processing task that identifies the sentiment of a document, such as whether a sentence, tweet, blog, or article expresses a positive or negative opinion. Machine learning approaches like n-gram models represent documents as collections of n-grams and use them to train classifiers like Naive Bayes, Maximum Entropy, and Support Vector Machines that can identify sentiment with over 80% accuracy. However, sentiment analysis still faces challenges in handling negation, mixtures of sentiment, ambiguity, and identifying sentiment towards specific aspects.