From my experience I divide doubts into two types
First: You just have a thought that maybe all religion or Islam is just a product of Humans, maybe all prayers seem useless and similar experiences. And you have these thoughts without any particular reason
Second: You read a Hadith/Quran or hear about Islam from someone and think this does not seem right
First problem could have two reasons
- Maybe you are getting farther and farther from the study of Islam and don't have someone to talk to you about Islam (A Muslim with some knowledge to share) Maybe you are not reading Quran as much as you should?
As Quran say
The believers are only those who, when Allah is mentioned, their hearts become fearful, and when His verses are recited to them, it increases them in faith; and upon their Lord they rely
You are having waswasays (Unintential thoughts which comes to mind without any reason) so what should you do in this case?
Here is hadith
Narrated Abdullah ibn Abbas:
AbuZumayl said: I asked Ibn Abbas, saying: What is that I find in my
breast? He asked: What is it? I replied: I swear by Allah, I cannot
speak about it. He asked me: Is it something doubtful? and he laughed.
He then said: No one could escape that, until Allah, the exalted,
revealed: "If thou went in doubt as to what we have revealed unto
thee, and ask those who have been reading the Book from before thee."
He said: If you find something in your heart, say: He is the first and
the Last, the Evident and the Immanent, and He has full knowledge of
Arabic Dua is highlighted
And you said that how could ALLAH be so unfair yes ofcourse ALLAH knows how we human are and have the direct answer from Prophet (Peace be upon him)
You can see that it's part of Imaan to have waswasay it means that Shaytan is attacking you because you have something which is think you shouldn't have
Second problem could be bacause you don't have enough knowledge maybe what you have heard is not what Islam is but you are unable to confirm because of resources or whatever reason you have - You should ask someone when you have this problem and if you read the Quran/Hadith yourself it could also mean that you didn't understand it right so in this case you should do it (Ask those who have knowledge this is what Quran says)
ALLAH knows best