This mistake hinges on just one word – ‘the’. The decision to include it or not changes the meaning of the phrase. Let’s start with the above sentence:
The correct sentence, ‘I will take an umbrella in case it rains’, means that you’ll carry an umbrella to prepare for the possible outcome that it might rain. The ‘in case’ is used to imply that something problematic could occur in the future. So you do an action to prepare for that problem ‘in case’ it happens.
Other examples are: I will take a sweater in case it gets cold, or I will take a charger in case my phone battery dies.
‘In the case’ means in a specific situation, and it is not necessarily linked to a problem, a future outcome, or something bad. For example, a teacher might say, ‘Everybody passed the test, except in the case of Filip, who was absent.’ Or, ‘In the case that I don’t get into university, I will become a plumber.’ e.g. Based on a situation arising, I will do something.
Let’s put the two together:
I will take a credit card to the pub in case I run out of cash. In the case that my credit card doesn’t work, I will phone my wife for help!