Didn't Samuel die in 1st Samuel?
Thanks for asking a question on thisisyourbible.com
You are correct that Samuel's death recorded 1 Samuel 25:1 proves that he cannot be the author of either of the books of Samuel.
The titles of these books do not indicate authorship. The titles indicate that they are about the life and times of Samuel and the events that occurred during and shortly after his lifetime. They are biographical and historical and no one has ever claimed they are autobiographical. For example, the books of Kings were not necessarily authored by by the kings themselves. Some would argue, with some justification that the arbitrary assignment of Samuel's name to First and Second Samuel was not the best choice. The books deal with three major figures: Samuel, Saul, and David not just Samuel. It could be argued that of the three, David is by far the most important figure.
The short answer is that we are not told exactly who the author of these books was. However, the same is true of many other books of the Bible as well. The primary author through inspiration is God. Perhaps the anonymity of the human authorship of many of the books of the Bible is designed to teach us just that point.
Here are links to material that you will find useful:
I hope you have found this helpful.