Praise be to Allah.
What you mentioned about the sons of the deceased son not inheriting from their grandfather is correct, but that is subject to the condition that the deceased grandfather does not have one or more living sons. In that case the grandsons are prevented from inheriting by the presence of the son, namely their paternal uncle.
But if the grandfather does not have any living sons, then his grandchildren inherit from him.
What some of the common people think, that the grandsons should take their father’s share, is contrary to the scholarly consensus that one of the conditions of inheritance is that there should be certainty that the heir was alive after the death of the deceased, because in this case the son died before his father, so it is impossible for him to have a share of his father’s estate who died after him.
It says in Tuhfat al-Muhtaaj fi Sharh al-Minhaaj (6/402): “ ‘If the two types are both present,’ meaning his own children and his son’s children, ‘whether his own child is male’ only, or there is also a female, ‘the son’s children are prevented from inheriting’ according to scholarly consensus.”
But in a case where the son’s children do not inherit, it is recommended to make a will in their favour, so long as it does not exceed one-third of the estate, especially if they are poor and in need.
The son’s children may inherit from their grandfather on condition that he does not have any living son (whether this son is their father or their paternal uncle), in which case they do not inherit. The scholars are agreed on this point.
The Muslim should believe that whatever Allaah has decreed is wise, just and merciful, even if they cannot see that, and that Allaah prescribes for His slaves that which is in their best interests and will bring them prosperity and happiness.
Allaah says (interpretation of the meaning):
“Allaah intends for you ease, and He does not want to make things difficult for you”
“Allaah wishes to lighten (the burden) for you; and man was created weak”
“But no, by your Lord, they can have no Faith, until they make you (O Muhammad) judge in all disputes between them, and find in themselves no resistance against your decisions, and accept (them) with full submission”
“It is not for a believer, man or woman, when Allaah and His Messenger have decreed a matter that they should have any option in their decision. And whoever disobeys Allaah and His Messenger, he has indeed strayed into a plain error”
“And who is better in judgement than Allaah for a people who have firm Faith”
And Allaah knows best.