Why Did the Prophet Have So Many Wives?

Prophet Muhammad had one wife most of his life but many wives toward the end, why?