Sorry, there is no simple formula for eliminating ambiguity in pronoun references.
Sometimes the gender of the pronoun will be sufficient. Like, "Mr Brown, the teacher, gave the student her notes." "Her" must refer to the student because the teacher is now identified as male.
Or the number of the pronoun may indicate which. Like if you said, "The teacher gave the students their notes", as "teacher" is singular and "students" is plural, "their" must refer to "students".
As @stoneyb says, often we can tell from the larger context. You probably wouldn't just walk up to someone and say, "The teacher gave the student her notes." What teacher? What student? It would likely be part of a longer conversation. "My friend Sally is taking a physics class. She was sick and missed a couple of classes, so she asked the teacher if she could have a copy of her lecture notes for those classes. The teacher gave the student her notes." Now it's clear from the context that we mean the teacher's notes.
Often simple logic will tell us which is meant. "When the driver hit the deer on the highway, his insurance paid for the damage." As deer rarely have insurance -- they're very irresponsible that way -- "his" here almost certainly refers to the driver.
But yes, it often happens that none of these things help in a particular case. The only choice than is to add additional words to clarify.
It does indeed sound repetitive and awkward to repeat the same noun. "The teacher gave the student the teacher's notes." How awkward it sounds depends on how often you repeat the word and how close together the repetitions are.
A very common alternative is to use different words to refer to the same person or object, where the identification is either spelled out in context or is logically obvious. "When the driver hit the deer, he was badly injured." Does "he" here refer to the driver or the deer? It could be either one. But, "When the driver hit the deer, the man was badly injured." Now we haven't repeated the word "driver" but we have made clear that it was the human and not the animal that was injured. (Well, the animal may have been injured also, but that's not the point of the sentence.) This is particularly useful when the problem is not repetition within a sentence but between sentences. "The student approached the teacher after class. The student told the teacher that she wanted to get the notes. The teacher gave the student her notes." Very repetitive sounding. But, "Sally approached her teacher after class. She told Dr Brown that she wanted to get the notes. Dr Brown gave the student her teacher notes."
Some writers consider it less awkward to put a repeated word in parentheses after the pronoun. "The teacher gave the student her (the teacher's) notes." I wouldn't do this in every sentence, but it works when used rarely.