The Quran says that no soul bears the burden of another, and that Allah does not wrong anyone by even the weight of an ant. So the suffering of a child is never seen as punishment for something he or she did. The Prophet ﷺ taught that children who die are in Allah's mercy, and in a dream that he saw, the children who died on the natural disposition were with Abraham, peace be upon him, in Paradise. For Muslims, the idea that a child's life is cut short without any compensation is not how the story ends.
Muslims also believe that much of the suffering of children comes from the injustice of adults: war, hunger, neglect, abuse. Allah gave people the freedom to choose and the duty to protect the weak, and the Day of Judgment is the day on which what was done to the innocent is accounted for. The Prophet ﷺ once saw a woman among a group of captives who kept taking up any child she found to nurse it, and asked his Companions whether they thought she would throw her own child into the fire. They said no, and he said: 'Allah is more merciful to His servants than this woman to her child.' A believer's trust is that the One who is more merciful than any mother does not overlook a child's tears.
Islam does not turn this into a formula. The Prophet ﷺ himself wept when a child of his daughter was brought to him dying, and when asked why, he said that this is mercy that Allah has placed in the hearts of His servants. Muslims are therefore not asked to accept it coldly. Not every childhood suffering has a human cause, as illness shows, and for such cases Islam admits that the full wisdom is known to Allah alone. Muslims are asked to trust Allah's wisdom beyond what we can see, to give care to children in need, and to remember the promise of the Prophet ﷺ that the one who looks after an orphan will be near him in Paradise.