Why were there viziers?

In Ancient Egypt, there were people who held the title of Vizier. They were the highest official in the country and their sole purpose was to serve the kings and pharoahs.