When you speak of the Neviim and Kesuvim of being factually accurate, you are likely referring to the historical accounts of what is written in those sections of the Tanach, most of which take place in the historical books of the Neviim.
The classical commentators (of course, I cannot speak for all of them) understand the books of the Neviim to have been written through nevuah, which they understand to be free of factual error. Thus, any historically factual claim made by the navi is understood to be true as it must have been known to him by his prophecy.
Abarbanel writes regarding the sources of the authors of the Neviim:
והבחינה השלישית היא במה שהאל ית׳ בשפע גבורתו הודיע לנביאים דברים רבים שלא היו נודעים בישראל, כדי שיכתבו אותם בספריהם, וזה במחשבות האומות ומלכיהם ודבריהם ועונות בני ישראל ותשובותיהם, ושינחם ה׳ על הרעה אשר אמר לעשות אליהם, וכדומה לדברים האלה שלא היה אפשר לנביא שיגבילם וידעם כי אם מפי הגבורה. ואמנם אופן כתיבת הספרים ההם ואיך ידעו הנביאים הדברים העוברים בימים הראשונים אשר כתבו על ספר אין ספק שמצאו הנביאים דברים נכתבו באותם הזמנים בספרי דברי הימים שנזכרו בספר מלכים, והיו נכתבים אותם הדברים מאותו זמן אם על ידי השופטים או המלכים או שאר חסידי אותם הדורות וסופרים, ומאשר היו מפוזרים ומפורדים מזה אחד ומזה אחד, והיו בהם דברים נכתבו כפי הרצון ולא כפי האמת, ומהם דברים מיותרים, כי זהו דרך הסופרים ומגידי הדברים לשבח ולגנות יותר מהראוי כפי אהבתם ושנאתם, והיה א״כ מעורב בהם האמת עם השקר והמותר עם ההכרחי, לכן נחה רוח ה׳ על הנביאים ההם ויצום לחבר על ספר כל הספורים ההם בשלמות ואמת, ויאספו אליהם כל הכתבים ההם והודיעם האל ית׳ בנבואתו השלמת אותם הדברים ואמתתם והצדקם והבדלת האמת מן השקר וההכרחי מהבלתי הכרחי
Abarbanel believes that the authors were neviim who used the royal historical records as sources for their writings, but were guided by God in what was true and what was exaggerated or biased; additionally, they were told prophetically anything which is impossible for humans to know, like the thoughts and feelings of nations, individuals, and God, as well as private conversations and the like.
Now, what about indiviual stories about neviim that often occur in Neviim Acharonim? Like, did Ezekiel really visit a valley of bones? Did Isaiah really walk around naked and barefoot for three years? That is a different question. Whether one would like to understand those stories as actual occurences or as metaphorically inspirational visions of the navi, they have no effect on the "inerrancy" of the Prophets.
With regard to your particular question about Shlomo and his wives and concubines: First of all, it is unlikely that any but a few of his wives actually lived in Jerusalem. Shlomo, like many kings in those days, probably married many foreign women for political purposes, as was probably the case with Pharoah's daughter. Additionally, it is unlikely in regard to most of his wives/concubines, that he ever visited them more than once in his lifetime. More likely that he had wives and concubines living all throughout Israel, besides for the ones that perhaps lived in foreign lands.
EDIT: To address the books of Kesuvim, since we are quoting Abarbanel, I should mention that he seems to believe (and I'm sure there are others who would disagree) that the authors of Kesuvim were not completely "inerrant", being that he has no problem with suggesting that Ezra, the assumed author of Divrei Hayamim who used the earlier books of the Neviim as historical sources, indeed erred in his understanding of a verse in Sefer Melachim. [This is a consequence of the belief that the Kesuvim were written without the authority of prophecy (unlike the Neviim), but are nonetheless written with ruach hakodesh, which is divine assistance in the perfect phraseology for the expression of ideas the author wishes to express (so much so that intricate inferences can be made from the specific language the author uses), but not necessarily divine assistance in factual inerrancy.]