How do investigators always know the logged flight time of the pilots?
The methods that Dan referred to in his answer are valid, and might be used by investigators—the NTSB for example.

However, generally speaking the NTSB will not spend a great deal of effort researching pilot time. Instead they will resort to one of two methods of determining pilot experience.

Firstly, if a logbook is readily available—either found at the scene or made available through the investigation—it will be used to determine pilot experience.

Secondly, if a logbook is not readily available, the NTSB can determine pilot experience based on the pilot's reported flight time on his or her last application for a medical certificate. Since an application for a current FAA third class medical can be several years old, private pilot experience determined by this means may not accurately reflect an accident pilot's actual level of experience. However, a professional pilot's application for an FAA first or second class medical will only be six to twelve months old, and will much more accurately reflect that pilot's actual level of experience.

Similarly, FAA certificated pilots report their flight time on some IACRA applications for pilot certificates. This reported time will have been independently verified as accurate (unlike times reported on medical certificates). However, in most cases, a pilot will have applied for a medical more recently than for a certificate.

For actual examples of these two scenarios, see NTSB report CEN16FA333, in which both are detailed.

For the first pilot involved:


  The [first] pilot's flight history was reconstructed using logbook documentation. His most recent pilot logbook entry was dated July 31, 2016, at which time he had accumulated 135.5 hours total flight time, of which 48.6 hours were listed as pilot-in-command. All of his flight time had been completed in a Cessna model 172N single-engine airplane. He had accumulated 5.0 hours in actual instrument meteorological conditions, 12.9 hours in simulated instrument meteorological conditions, and 3.4 hours at night. He had flown 24.7 hours during the prior 12 months, 4.4 hours in the previous 6 months, 2.4 hours during prior 90 days, and 1 hour in the 30 day period before the accident flight. The pilot's logbook did not contain any recorded flight time for the 24 hour period before the accident flight.


For the second pilot involved:


  According to FAA records, the [second pilot], age 60, held a private pilot certificate with a single engine land airplane rating. His last aviation medical examination was completed on November 6, 2014, when he was issued a third-class medical certificate with a limitation for corrective lenses. A search of FAA records showed no previous accidents, incidents, or enforcement proceedings. A pilot logbook was not recovered during the on-scene investigation; however, on the application for his current medical certificate, he reported having accumulated 120 hours of flight experience.