We get our knowledge about history through books and scientific methods (such as carbon dating), schools, stories, songs, arts, etc. I understand history is written by the victor and that it's biased and all that. I also understand it is a very important subject due to how interesting it is and how much historical education is pertinent to learn from past mistakes and build on past success, not to mention the many other benefits such as preserving culture. It's just that whenever I get into a deep enough historical/philosophical debate I am always greeted by the go to-line: "How can we be sure that anything we know about history is true? Were you there?". These seem like a cop-out and I inevitably rebut with the aforementioned facts that there are records, arts, etc. to back up historical claims but that just doesn't seem to fully cover it...
Even I begin to question what I know about these things, comparable to a priest having a lapse in faith. Am I missing something? I understand everything needs to be taken with a grain of salt and to read between the lines and form my own opinions, but opinions are invariably based on fact and if I cannot know the fact of the matter, I must base my opinions on how I feel about it. But that is always jaded by what society has told me is true, whether it be past or present society (though I have only ever lived in present society). This is like trying to rely solely on witness testimony which has been proven to be a bad way to base a case.
*Sorry about inevitable typos, I'm on mobile. Also if this is the wrong subreddit, please point me in the right direction as I am bad at rediting.
TL;Dr: See Title.
This is a really interesting question that I think historians consistently have to ask themselves (even when they don't think of it in these exact terms). I'm sure there are many ways of trying to answer it, but here's one take:
First of all, there is the collection of evidence (well, not really first of all- there is theory, too, but we'll get to that in a bit). There is a general acceptance that if evidence (documentation, oral history, etc.) is collected in a high volume, various individual pieces can corroborate each other. While it is technically possible that several distinct persons with no evident connection to each other got together to fabricate a story, this explanation becomes less likely with each corroborating document. This is why historians like to use a wide range of sources. Think of it like the cross-referencing (edit: cross-examination! Cross-referencing is what you are actually doing with the documents, I suppose) of witnesses at a trial.
As for theory- there are several that attempt to answer your exact question. Most recent theories (in the last 50 years or so) somewhat side-step the issue of historical "truth." There is an implicit agreement not to question the heck out of every minute detail, but there is also a general healthy (or, to some, unhealthy) skepticism. This came as a result of many movements in critical theory and philosophy, but at its heart it was a reaction to an age-old assumption that history could be objective. So most historians will occupy at least some of their word-count establishing a theoretical framework which sets the limits of their knowledge, or their ability to attain knowledge (epistemology). For example, I might attempt to be a "relativist," and try to inhabit the mindset of the era that I am studying to understand why they would conceive of things in the way that they did. In so doing, I might find myself more interested in the history of thought (intellectual history), rather than "fact" (political, material history etc.). Anyway, it's a very fractious area of theory. You might consult the works of structuralists and post-structuralists like Derrida, Lacan, Foucault, and others for more information on the questions of relativism, objectivism/subjectivism and the like, or even look to the movements of Marxist and feminist history to see how some historians proposed to study history "from the ground up," forming a new method of "social history" which has employed demographic data, personal journals, material history and other methodologies in an attempt to balance what early social historians considered to be the "lofty" and exclusionary tendencies of traditional political, religious, and intellectual history.
I hope this has at least offered a little insight into your question. It's a tough one to answer!