Well, in case it is a scientist who has discovered something, the world will learn about it through an article that this scientist will publish in a journal, not through hearsay or rumors. So the written version will in most cases precede the spoken version.
Second, words that are created by scientists are usually based off of existing words or names. And there are certain morphological conventions that provide a general guide for how various suffixes or prefixes are attached to a word. For example, the chemical element #106 in the periodic table, seaborgium, was named after the American chemist named Seaborg. The usual suffix -ium was attached to his name. So, for example if somebody were now to discover or prove the existence of another element and wanted to name it after the Christian polemicist Eusebius, this element would be called eusebium, and most (educated) people would recognize the reference and write this word this way even if they'd only heard about it, not seen it written. Even terms that contain Greek/Latin roots are usually re-using roots that had already been in use in English for a long time, so well-educated people will usually recognize the re-used component—a spelling for it had already been established.
In case we are not speaking about scientists but about regular Joes who create slang words, nowadays most of those are created on the internet—where people type rather than talk.
Most new words that appear are variations on existing words. From the words that were recently added to the Oxford Dictionary, "mansplaining" comes from "man" and "explaining", so no one who knows how to spell both of these words (and who knows what the word is supposed to mean) would write "mansplane". "Hangry" is a blend of "angry" and "hungry" (and also spelled pretty straightforward). Words that have been taken from other languages (like Korean or Japanese) would probably also first have been used in writing.
If there are two concurrently used variants (both by educated people who just disagree about which morphological principle would apply here), one variant, with time, simply wins. For example, long ago, words "country" and "journey" were both spelled with the ending -ey (so it was "countrey"). In the second half of the 17th century, there was a curious uptick in the usage of "journy" (so it seemed to go the way of the "country"), but then it died out, and the word is still spelled "journey".
This applies not just to spelling but also with respect to opinions about what certain words mean. Sometimes a variant that begins as an error just takes over. E. g., the word "fortuitous" used to mean "accidental". Since it resembles "fortunate", someone at some point erroneously used "fortuitous" when this person should have said "fortunate". As the American Heritage Dictionary's usage notes indicate, in 2005, two thirds of the panel of experts accepted this new use of the word, while in 1967, only 15% supported it. This also shows us that the business of lexicography (writing dictionaries) involves polling competent language specialists about their feeling of what should be right. And with time, these feelings change.