The authorship and date of writing for 1-2 Samuel are uncertain. While some scholars attribute parts of 1 Samuel to Samuel, there is no way he could have written all of it, as he dies before 1 Samuel ends (25:1).
A majority of Biblical scholars view 1-2 Samuel as part of a larger compilation, the Deuteronomistic History, which includes Deuteronomy, Joshua, Judges, 1-2 Samuel and 1-2 Kings. These books chart the theological history of the nation of Israel from the conquest of Joshua to the dissolution of the kingdoms of Israel and Judah, evaluating the nation based on the laws and principles of Deuteronomy. As such, 1-2 Samuel are not attributed to a single author, but rather are believed to be an edited work by the Deuteronomists, compiling multiple source materials and firsthand accounts to form the books as we know them today.
1-2 Samuel was also originally a single work, but was divided into the two books we now have when it was translated from Hebrew to Greek.
The actual date for the authorship of 1-2 Samuel is also difficult to ascertain. It has been suggested the work was written directly following the events in the book. However, it is more likely that this work was compiled during the exile (after 586 bce), though many of the source materials would have been written much closer to the dates of the actual events.
While the entirety of the Old Testament is well-written, 1-2 Samuel is a literary masterpiece. This work is permeated with excellent literary style and techniques including theme and symbolism, dialogue and description, chiasmus and parallelism, word play and repetition. As such, it is important to understand how to read Hebrew narrative, and pay attention for those literary devices, as they are there for a reason.
The central theme of 1-2 Samuel is Kingship. This work presents how the nation of Israel moves from being a loose tribal organization ruled by a direct covenant with God to being a united kingdom under the ruling authority of a king. 1-2 Samuel does not provide a unified perspective on kingship, it offers both negative and positive views.
Following this theme, it has been proposed that the main purpose for the writing of 1-2 Samuel was to affirm the Davidic dynasty, confronting the charge that David usurped a throne he had no legitimate claim to. As such, 1-2 Samuel proves the theological validity of David’s kingship.