I attended a very religious Jewish school in London. A Rabbi there- at aged 8, made me an instant atheist. I was told the soul of every Jew was at mount sinai when the Torah was given. Then, that Hashem knows every single thought of every unborn human being. That seemed so ridiculous. More so if true, why is Hashem interested in humanity if he knows exactly how the end is going to play out? What’s in this for Hashem when he knows, not just the ending, but every word and thought in the script?
It's very unfortunate that sometimes bad teachers (of which there were many after the upheavals of WWII!) ruin great topics, and especially when they confuse young children, leaving scars for a long time. Nevertheless, it's never too late to strive for truth, and I admire your questioning! As you inferred, a monotheistic God, by definition, is perfect, and doesn’t need or “gain” anything from this world. Nevertheless, He created the world out of altruism (=selfless giving, to give to us without gaining, which is part of His perfection), to give us the ultimate perfect gift, which is the soul (=a spark of Himself) in “His image” (Breishit 1, 26-27), giving us the possibility to emulate or copy Him (for our sake). The Torah is the guidelines to teach us how to realize our Godly potential (based upon the 13 Godly traits and ideals, see Shmot/Exodus 34, 6-7). Even though God knows the future, He granted us that greatest of gifts, the capability to be like Him, which includes being independent and having free-will. In short, you are correct that it's obviously not for Him, but for us, to have that possibility of success and earning our physical and spiritual advancement.