Now it is necessary that God’s goodness, which in itself is one and undivided, should be manifested in many ways in His creation; because creatures in themselves cannot attain to the simplicity of God. Thus it is that for the completion of the universe there are required different grades of being; some of which hold a high and some a low place in the universe. That this multiformity of grades may be preserved in things, God allows some evils, lest many good things should never happen, as was said above (22, 2). Let us then consider the whole of the human race, as we consider the whole universe. God wills to manifest His goodness in men; in respect to those whom He predestines, by means of His mercy, as sparing them; and in respect of others, whom he reprobates, by means of His justice, in punishing them. This is the reason why God elects some and rejects others.
Summa Theologica Ia. Q.23 A.5 ad.3