Historians can never truly know what the past was like. This is why historians have different interpretations of the past and how it occurred. Having said this, historians can still form a detailed and comprehensive understanding of the past, and they use numerous and different types of sources to achieve this.
Firstly, historians use primary sources which means historical sources that were created at the time of the event being studied. This can involve written records from the time (e.g. royal decrees) or architecture (e.g. castles).
Secondly, historians use secondary sources which means historicla sources that were created well after the time of the event being studied. This can involve interviews of academics, books published by historians or documentaries.
In essence, one can understand the past even if they weren't alive at the time by using a combination of historical sources.