In formal Latin, the dative case is used for indirect objects. In common Latin, the preposition "ad" with the accusative case was used instead. You can almost always get a good translation of a dative word by adding "to" or "for" before it.
1st declension:
Dative singular: amicae
Dative plural: amicis
2nd declension:
Dative singular (masculine): amico
Dative plural (masculine): amicis
Dative singular (neuter): oppido
Dative plural (neuter): oppidis
3rd declension:
Dative singular (masculine/feminine): homini
Dative plural (masculine/feminine): hominibus
Dative singular (neuter): corpori
Dative plural (neuter): corporibus
4th declension:
Dative singular (masculine/feminine): manui
Dative plural (masculine/feminine): manibus
Dative singular (neuter): cornu
Dative plural (neuter): cornibus
5th declension:
Dative singular: rei
Dative plural: rebus
What is an indirect object? With some verbs -- those of giving, showing, telling, and similar -- there is both a direct object and an indirect object. The indirect object is the person who benefits from the action. The classic example is giving: the subject, who is nominative, gives something accusative to someone dative.
Exempli gratia:
"The boy gives a sandwich to a friend." "boy" is the subject. "sandwich" is the direct object. And "friend" is the indirect object, becoming dative. "Puer panem fartum amico dat."
"The teacher tells a story to the children." "teacher" is the subject. "story" is the direct object. "children" is the indirect object. "Magister fabulam liberis narrat."
English does something strange with indirect objects as well. When the direct object goes before the indirect object, the indirect object needs the preposition "to". But in English, we can swap the order of these elements and get rid of "to". So the examples above could also be: "The boy gives a friend a sandwich." "The teacher tells the children a story." Same meaning, same Latin, different English.
Many compound verbs point towards a dative word. A compound verb is a verb with a prefix (generally derived from a preposition). Compound verbs in Latin often require a dative to complete their meaning. Sometimes they also get an accusative direct object. This is all partly up to the verb itself: knowing whether it gets a dative object is part of knowing how to use the individual verb. But if you are working your way through real Latin and learning new words as you go, never be surprised to find a dative in the same clause as a compound verb.
Exempli gratia:
"The boy was meeting a friend." "meet" is "convenio, convenire", a compound of "cum" (with, together) and "venio, venire" (come). "convenio" uses the dative to show who is being met. "Puer amico conveniebat."
Some verbs get dative objects despite neither having true indirect objects nor being compound verbs. This, again, is down to vocabulary: when you learn a verb that gets a dative object, you should become aware that it does so. Some adjectives also trigger a dative in this way to complete their meaning.
Exempli gratia:
"The sandwich pleased the boy." The verb "placeo, placere" (please, be pleasing) is one of those verbs that naturally gets a dative. You can think of this instead as "The sandwich was pleasing to the boy." "Panis fartus puero placebat."
"The sandwich was suitable to the boy." The adjective "idoneus, idonea, idoneum" (suitable) naturally gets a dative to complete its meaning, which makes sense if we're already adding "to" in English. "Panis fartus puero idoneus erat."
The dative, when paired with a form of "sum, esse", is also a way to show possession: we call it the dative of possession. While we can say "The boy has a sandwich" -- "Puer panem fartum habet" -- we can use the dative of possession instead. Take the subject (Puer) and make it dative. Take the direct object (panem fartum) and make it the nominative subject. Instead of "habet", use the same tense of "sum, esse" that agrees with the new subject. "Panis fartus est puero" -- "There is a sandwich for the boy."
You will find the dative used in many other ways in Latin as well. The good news is this: if you try translating it with either "to" or "for", you will almost always get a correct answer.
When you're writing Latin and you want to say "to", consider the following:
Is the next word a verb? If so, make it an infinitive verb. "The boy is able to walk." "Puer ambulare potest."
Are you talking about motion from one place to another? If so, use "ad" plus the accusative. "The boy is walking to school." "Puer ad ludum ambulat."
Otherwise, go ahead and use the dative.
If you want to say "for", consider the following:
Are you talking about buying something for a specific price? Use the ablative with no preposition. "The boy buys a sandwich for two coins." "Puer panem fartum duobus nummis emit."
Are you talking about an exchange or substitution? Use "pro" with the ablative. "Mr. MacGregor is teaching for Mr. Blue today." "Hodie Magister Gregorius pro Magistro Cyaneo docet."
Otherwise, go ahead and use the dative.