A Tyrannosaurus rex skeleton has become the most expensive dinosaur fossil sold at auction after an unidentified buyer paid more than $50m (£37.3m) for it.