Let's assume, before the january 20, votes are announced. Donald Trump is not the president yet. But it's certain that he will/is going to be(I don't know which one to use). We use "be going to" for decided events. But also we use "will" for simple future facts. I can't decide which one to use. It's like to me; I can use "will" because it's a simple future fact, certain. On the other hand, I can use "be going to" because it's an event arranged before; it's decided. Which one should we use? Thanks..
You are really looking for the immediate future: "but he becomes president".
"Going is mainly used to refer to our plans and intentions or to make predictions based on present evidence. (ef.com: future going)
The sentence isn't explicit about the referent of mainly, all alternatives or only the plans and intentions. The difference is not substantial, because future tense always predicts the future, evidently.
Becoming president is not only an individual activity, but rather passive. The plan might fail.
Colloquially, to be going to is being used just the same as will (according to other answers), but formally, to be going to doesn't exist, though. To will marks intention all the same, but it's simply shorter. To be going to doesn't express with certainty the inevitability of success
You can use either in this case for all the reasons that you have articulated. In English, there are frequently several grammatical ways to say the same thing.
"Be going to" is far less used in serious writing than "will/shall." So there is a difference in terms of speech and writing and in terms of informality and formality of tone.