Don't hope for a bunch of unprofitable children, and if your sons turn out to be non-believers, don't take any delight in them or your grandchildren. In fact, if you're worried your kids might turn out to be atheists, just don't have them. Solomon has seen all these things and heard worse, like a time when god set fire to a country that didn't believe in him, or another time when he killed 600 000 soldiers. Nonbelievers might sometimes escape unharmed, but it's a miracle if it happens. God rewards as well as punishes, though.
At some point, god is going to visit, and when he does, there will be earthquakes, because we can't understand how god thinks, because most of his works are hidden.
God made man out of clay and gave him power over the earth, but also made all the animals afraid of us. God also divided something into seven operations (v. 5). He gave five to all animals, then gave men the sixth and seventh, which would be understanding and speech. I'm so glad I don't have to use this book to understand science, because it is literally that specific about what god gave to living creatures.
In a nice bit of revisionism, now god always intended us to understand good and evil and he showed it to us on purpose. He opened our hearts so we might see his works and praise him for it, because god is nothing if not a gloryhound. Then he told us all to spy on our neighbours, because we're all evil inside.
God also appointed all the rulers of nations, but Israel is his special baby, which means they get watched closer than anyone.