Last and First Men by Olaf Stapledon

A towering work of sci-fi. Written in 1930, it charts the history of humanity from the inter-war period to 5,000,000,000,000 AD. The premise is the cycle of human evolution and extinction in 18 civilisations, from current earth to the last men.