First of all, "es" is the nominative form of the pronoun meaning "it". The dative form of "ihr" ("you", as in several people) would be "euch". "ihr" can also be the dative form of "sie" ("she"). I think you are confusing the two meanings of "ihr". Your examples are both grammatically correct, but they have different meaning:
"Ihr lernt deutsch." = "You learn German."
Here "ihr" is the second person plural pronoun meaning "you" (several people) and not the dative form of "sie" ("she").
"Sie lernt deutsch." = "She learns German."
In both of these cases, "ihr" and "sie" are in nominative case because they are the subject of the sentence, identifiable by the question "Who is learning German?".
Understanding how "I am fine" translates to "Mir geht es gut" (or just "Mir geht's gut") can be somewhat difficult. In English, the verb ("am") is conjugated based on the person being fine ("I"), but this is not the case in German.
In this context, the verb "gehen" is what is called an impersonal verb, meaning that it has a dummy subject after which the verb is conjugated. An example of an impersonal verb in English is
"It is snowing"
Here the pronoun "it" carries no real meaning, and "snowing" is therefore an impersonal verb.
We can see how this relates to our German sentence if we instead translate
"Mir geht es gut."
as
"It is going well for me."
We see that the subject of the sentence is actually "it". This means that "me" will receive either accusative or dative case since it is an object of the sentence. Deciding between accusative and dative can be rather difficult, and the most truthful answer is simply that you have to memorize that a lot of impersonal verbs take dative case, for example:
"Es gefällt mir." = "I like it."
"Es tut mir leid." = "I am sorry."
"Es schmeckt mir." = "It tastes well (to me)."
A clue that the case is dative might be that it is "for me" in the sentence since a rule of thumb is that objects which answer the question "For/to whom?" receive dative case.