Ich danke ihr
How do I know if the ihr means you or her in the sentence "Ich danke ihr"?
For all Duolingo sentences, the formal "you" (Sie; Ihnen) is consistently capitalized. So if the relative pronoun appears midsentence (not at the beginning, where everything is capitalized), then you will know that "ihr" is "she".
And BTW, German has only four cases compared to Polish with seven =)
Ihr only means you if it is in the nominative case (meaning if it is in the subject of the sentence), however for the dative case, ihr means she. Cases are definitely the hardest part about German, imo :) Here's a chart of the different ones http://german.about.com/library/blcase_sum2.htm
You can't really tell the difference without the context. It's just the same as the English sentence: "I thank you" can be adressed either to one person or more (German has three ways of translating this sentence depending on the context: Ich danke dir. - Ich danke euch - Ich danke Ihnen).