Ruth is the last book from the judges period, before there was a king in Israel. Much like the stories in Judges chapters 17 through 21, the story of Ruth is a sort of vignette, telling us about the lives of individuals but also painting a picture of the chaos and danger that reigned during this period.
Thematically, the book of Ruth serves as a bridge between the stories in Judges and the stories that follow in Samuel. The book of Ruth opens by telling us that the events occurred "in the days when the judges governed", and ends by telling us that the future King David was a descendant of Ruth. I believe that Ruth (much like Judges) was written with the knowledge and context of the later histories of Israel's kingdom. It only mentions the future king at the very end of the book, which could be a later edit. However, there are thematic similarities between Ruth and Judges that imply they had a common author, or at least common knowledge.
The entire book of Judges is devoted to showing us why we needed a king; every story points to the anarchy and sinfulness that filled Israel before they had a king. The book of Ruth really only has one purpose: to show us part of the history of how that king was brought into the world. Like I said, it forms a bridge between the period of the judges and the period of the kingdom. As such, Ruth would not make any sense without the former or the latter. Without a kingdom to lead us to, Ruth has no purpose. And without Judges as the context, Ruth doesn't explain why we need a king.
I believe this answers some of the questions about authorship and dating for Ruth as well. It is likely that it was authored by the same person or group that wrote Judges, and around the same time. Since the dating of Judges itself is disputed, it's hard to get more specific than that. I think it is strongly likely that they were written during the kingdom period, but more than that is hard to say. The authors of all these books leave themselves anonymous. Tradition says that this book was authored by Samuel, but there isn't any textual support for that. In my opinion, it's as good a theory as any, because the truth is that we just don't know, and probably never will.
I think these books, like Ruth and Judges, don't tell us who wrote them because we aren't supposed to focus on the author. I think it's interesting to try to figure out who might have written them, but I don't think it detracts much from our understanding to leave this question unanswered.
Apart from understanding the anarchy of the judges period, we also have to understand the mutual hostility that has formed between Israel and Moab. These two nations are related through Abraham and his cousin Lot, but from the very beginning when Israel passed near to Moab in the book of Numbers, Moab resisted Israel (beginning, but by no means ending, in Num 22). More recently, Moab was one of Israel's many oppressors during the judges period (Judges 3:12-14), so they have also been in open conflict.
We should also remember Israel's prohibition against intermarriage. That, plus the hostility against Moab, makes this entire book a somewhat awkward note. I want that awkwardness and the latent hostility to be in their minds as they read about Ruth and her journey into Israel with Naomi. I would say more, but Ruth is a short book so I want to save myself things to say when I write about the individual chapters.
We are on the cusp of something new. The judges are coming to a close, the kingdom is at hand, and Ruth is the book that ushers it in.