Here's a worked example:
Let's say a specific city gets from commerce the following:
a) trade routes totalling 12
b) worked tiles (plantations, aristo farms, gold mines, whatever) totalling 18
Giving a grand total of 30 commerce.
Now, let's say this city has in it the Brewery National wonder - with two food resources - giving +10% *commerce* - that would bring the raw total up to 36.
Now - out of this 36 - the slider is applied. Let's say you're giving 50 to money, 50 to science. That will give 18 cash, and 18 beakers.
Now - the slider and the commerce bonus is removed from the equation.
Onto this: add your merchant specialists, and your sages.
Let's say you've got no merchants, but your sages are giving you a total of 8 beakers (can't recall exactly what a sage gives, I'm just pulling a number out of the air).
If you've got an Elder Council, this will also be added at this point - let's say we do and its an additional 3.
This brings you up to 18 cash and 29 beakers.
Let's say you've got a Library, which gives IIRC +25% beakers. This adds another 7.25 - giving you a total of 36.25. AFAIK Civ will correctly store and calculate with the decimal point, even though it doesn't display it everywhere (I'd like to know if anyone's found this not to be the case).
And let's say you're also running God King and this city is your capital. This gives you +50% cash bringing you up to 27.
So 36.25 beakers would go to your research, and 27 into your treasury. Then the same sums will be done for all the other cities.
In practise, a good God King capital will preferably have priests and merchants, not sages - although you shouldn't rule sages out if you've got a good reason to run them.
If you find a Great Prophet, you're golden, because you can settle it and it will give you not +2 hammers and +5 coins, but +3 hammers and +7.5 coins
Really good boost early in the game, and that's why I make sure I've got at least 50 gold in my treasury at all times in case that event comes along in the early game.
One thing to note is that, if you ignore specialists and look at the raw commerce from tiles and trade, if there's a bonus from something like the Brewery, and you've got additional bonuses coming in from buildings like the Bazaar of Mammon (+100% to coin), the bonuses will combine exponentially.
So if the Brewery gives you +30% to *commerce* from all three types of grain, and the Bazaar of Mammon gives you +100% to coin, the +100% is applied on top of the +30%, giving you +160% to your raw commerce - pretty potent eh?
But you wouldn't see the full +160% come onto your merchant and priest specialists - only the Bazaar of Mammon would apply for them.
Now let's say you've got God King - giving you +50% to *coin* as opposed to Commerce - and the Bazaar of Mammon gave you +100% to coin - the bonuses are *additional* only. So you'd get +150% to all your coin that came in from trade and tiles (post slider application) - but on the other hand you'd get the +150% to your merchants and priests (at least the money part of them) as well.
It all does make sense when you understand what it's adding up.