Princeton University will pay $50-million and almost as much in legal fees to foundations controlled by the heirs of a major donor to the institution, in a settlement that ends a closely watched lawsuit over how strictly colleges must adhere to a donor’s wishes.