Stop words can be in most application removed when you are doing bag of words features. Some exceptions can involve sentiment analysis where ‘not’ cannot be removed because it is a stop word.
When you are not using bag of words, any model where you have context required – say n-grams or sequence-to-sequence models, removing stop words leads to less powerful and sometimes bad models.