I would always use this following explanation to high schoolers when I tutored for why they "have" to rationalize their denominators. I personally didn't care, but a lot of teachers would take off points if they don't.
In human history, people first started counting things, like how many cows they own: 1,2,3... These are called the "natural numbers" because you naturally start at one. We next realized that hey, "no cow" should also have a number, which we call 0 and we have a new set of numbers called "whole numbers". Naturally, debt came into the number systems because you owe me a cow (-1) or two cows (-2), and now we have a whole new set of numbers called the integers (negative and positive whole numbers). Well, next humans started discussing parts of the whole. If we have 5 cows, and I take 2 of them, I now have 2 of the 5 cows, or to make life simple, I have ##\frac{2}{5}## of the cows. Number wise, we now have numbers between numbers, and we call these the "rational numbers" because they are just ratios, or parts of wholes. Notice how square roots haven't been "invented" yet? So, your teachers are just following history, and because it's their class, we will too. I don't actually know the history of numbers that well, but the story worked for most of them!
Now, the math reason (Which I do for students in pre-calc/algebra 2)... rational numbers are defined to be ##\frac{a}{b}## where ##a,b \in \mathbb{Z}, b \neq 0## so, yes, your teacher is correct to take points off your test because you're technically wrong to keep it as ##\frac{2}{\sqrt{5}}##. But then I also tell my students that, technically, you can't even write ##\frac{2\sqrt{5}}{5}## because ##2\sqrt{5} \notin \mathbb{Z}## and you should have to write it as ##\sqrt{5} \times \frac{2}{5}## so if you ever want to be petty, feel free to bring that up in class.
So, to OP, that's why the answer key in a math book won't have square roots in a denominator, because by definition of rational numbers, that number doesn't "exist". Although, as you can see, most of us won't really care (which I also tell the students I use to tutor if I helped them with these concepts), but when in school grades matter, so best not to let points get away!