What they really did was measure the distances and redshifts of dozens of supernovae and looked which energy contents of the universe could explain the observed relationship assuming that the Friedman-Lemaitre-Robertson-Walker metric accurately describes the universe. Turns out you need 70% of something whose density does not change with the expansion.
This is the original paper if Hossenfelder's summary of the explanation compressed in one sentence does not convince you:
https://arxiv.org/abs/astro-ph/9812133
For a derivation of the relationship between redshift and distance see any introdctory text on cosmology, e.g. chapter 8 of https://arxiv.org/abs/gr-qc/9712019 (he arrives at the equation on the last page).
Edit: This goes into more detail of matter species in sec. 1.5 and touches on the SN observations in sec. 1.7: https://www.thphys.uni-heidelberg.de/~amendola/teaching/adv-... (on an unrelated note: he was my PhD advisor)