From what I remember, Machiavelli was a pretty respected person in Italy before the unification of the Italian states. He then got exhiled or fired or whatever from his position. A new prince took the throne. He wrote the book for the prince in order to get back into the good graces of the royal family. It is basically his advice to the prince on how to rule, on how to colonize, and on how to keep the colonies happy.
Its a good book if you ever plan on taking over large territories by force.