Suma is in nominative.
Trzech and pięciu describe suma: literally, the sum of three and five. Where English uses of, Polish usually uses genitive.
Osiem is in nominative, because it's on the other side of to.
If you remove the nouns in genitive, you'll end up with this also correct sentence: suma to osiem the sum is eight, which is exactly the same form of sentence that was drilled during the early lessons.
Thanks for the explaination, even though every stage of Polish kills a part of my ambition.
I look at it this way: I'm learning Polish for fun. The grammar is grotesquely complicated but that only means that you will spend more time learning it which is OK if it is fun.
Also I suspect that speaking Polish incorrectly is quite acceptable in many situations.
The issue is not so much that you may make grammar mistakes, but that you will say simple things in grotesque ways. Like her, which would appear in a math class or financial report, not normal speech.
More like in kindergarten ;-) I have to confess I had to teach arithmetics to a cashier or two, because they did not know what to do with the exact change I provided to get a bill back.