Statements in the Book of Samuel imply that someone who had witnessed at least some of the events recorded wrote it. However the original writer must have written most of it after Samuel's death (i.e., -
"Our guess is that the author was a high state official in frequent attendance at the court, enjoying the full confidence of David and his household, who served David throughout his reign in Jerusalem and also Solomon during the early years of his reign, and whose duties may have been connected with literary work."1
Most conservative scholars prefer the view that Samuel may have written or been responsible for noting the record of earlier events in the book (chs. 1-24). Then some unidentifiable writer put it in its final form later, perhaps soon after Solomon's death.
Rationalistic critics of the book tend to believe it was the result of much more piecing together, and some of them date its final form as late as 500 B.C.2