The properties of merging black holes and neutron stars across cosmic time