when I say "mir ist kalt" we don't add es (I think it would be correct if we did but it is odd) but we don't remove "es" in "mir geht es gut" I'm new to this language so there are a lot of things that I don't know about grammar
"Es" is a tricky word, because it is actually used in (at least) two cases (and if you're really new to German, you might simply want to ignore these very special cases for the time being):
- As an Expletiv. That is, when a verb doesn't really need a subject (because, semantically, there is none, but grammatically, there must be one), like in "es regnet".
- As a referral subject or object ("Korrelat") that refers to another component in the same sentence, because we don't want to emphasise that sentence component by putting it to the "Vorfeld" (i.e. first position in the sentence) to be able to put the verb into second position - Thus occupy this place with "Es".
(Your cases ar both (1))
Now to your examples:
Mir ist kalt.
Is valid because the dativus iudicantis fulfills the role of the object. This sentence consists of an object and a predicate (note: A minimum German sentence consists of a predicate, and a component that fulfills the role of a subject or an object). This is hard to understand for people with native languages that don't have a fully functional dative. It is maybe best you simply memorize the few example cases for dative and consult a good grammar book for the various functions of the dative in German.
Mir geht es gut
Is no dativus iudicantis, "mir" is just a "normal" dative object, thus needs a proper subject in the sentence - covered by the "es" in this case.
To me, the es is implied in the first example, but unspoken. The grammatical jargon here is "ellipsis", meaning that one or more sentence elements are left out even though they are grammatically necessary. You can say es ist mir kalt, but it would sound overly formal because the meaning can be understood without the es and custom dictates that it can be dropped. If fact, though I know some disagree on this point, to me the subject is es even though it doesn't appear in the sentence; thus the verb is conjugated in the third person singular. (That's my interpretation anyway. Like quantum physics, grammar can have multiple interpretations that produce the same predictions about which sentences are correct.) Consider Ich singe und spiele Gitarre. Technically there are two clauses here, ich singe and ich spiele Gitarre. In the second clause the subject has been dropped using the power of ellipsis, making it grammatically incorrect on it's own, but the subject is implied so the entire sentence still works as a whole.
The problem with ellipses is that it's often not clear when they are allowed. Dropping a sentence element may be fine or it may make you sound like Tarzan. In most cases, an ellipsis is not actually required even if it's customary. I think as a learner it's best to think of advice on when to use them as more custom and guidelines rather than strict rules. The situations where they can be used can also be very situational and arbitrary. In this case, as mentioned in tofro's answer, the main difference is that in one sentence the verb is sein and is used to describe something, and in the other sentence the verb is gehen and says what's happening. But the distinction is still rather arbitrary, and I think the best thing to do is to accept that some customs are just customs; they don't necessarily have to have a reason or logic to justify them.
This is one of the cases when a German sentence does not require a subject.
Generally, in a German sentence, a subject (or at least an es as a formal subject) is required. But there are exceptions.
The following sentences do not need a subject:
- Imperative sentences (Geh!)
- Sentences where the subject has been omitted, which is possible with sentences starting with a pronoun, but generally occurs only in spoken language (Bin schon da.)
- Sentences with an impersonal (subjectless) passive (Jetzt wird getanzt.)
- Impersonal active sentences with a dative or accusative object
Mir ist kalt, Mich friert is an example of the last type of sentence. Another example is Mich graut vor der Prüfung, which uses accusative instead of dative as in the previous examples.
This is some kind of a special case, and whether such a sentence is valid depends on the verb and also on whether there is a dative or accusative object. I don't think a truly general rule can be given for this, it's just one of a few special cases.
The es is enclitic reduced to 's and assimilated in complex consonant clusters: is[t['s]]
Mir is' kalt.
And as if to add emphasis, the proper exclamation follows a differe t word order
Wa, is mir kalt!
Assimilation looks different if the pronoun is referential, das/es, which allows repairing the phrase
Mir is[ses] egal
Mir ist das/es egal
As there is no repair for the dummie pronoun, this indicates that it is not meaningfully derived from 3rd person singular in the first place, which might be debatable in terms of etymology, that would lead us too far.*
? Mir ist es kalt
I consider that incorrect. If it exists in dialect it has no bearing on the question.
My point is, your proposal is phonologically unobtainable since the phrase belongs chiefly to the colloquial register where stilted wording is best avoided. In a higher register you might prefer to use the intransitive verb frieren or an impersonal (fairly objective) construction using das Wetter instead of indefinite es, in order to circumvent the issue.
*) I don't know that to be sure but one might argue that geht's had to be getz(?). It would be cognate to get in this view, because it patterns with get well, got better, most plausibly from the first person past tense in Proto-Germanic *gat and second person present tense *gitizi, subjunctive *getaiz (as reconstructed on en.Wiktionary, cf. get).