That is because those who disbelieve follow falsehood, and those who believe follow the truth from their Lord. Thus does Allāh present to the people their comparisons.1
Translation: Saheeh International (English)
1 So that they may know the results of their choice.
That mentioned recompense for the two groups is because those who reject Allah followed falsehood, and those who have faith in Allah and His Messenger followed the truth from their Lord. Thus, their recompense differs just as their efforts differed. Just as Allah showed His decision about the two groups, the group of the believers and the group of the disbelievers, Allah gives people their examples, so that similar things are linked.