Niccolo Machiavelli wrote The Prince so he could secure a place for himself in the newly formed Italian government under the Medici family. The Prince was meant to be a political handbook for rulers. It was not meant to be a literary work.
Originally, Machiavelli was a staunch supporter of the anti-Medici government. At that time, Italy was not a unified country. Instead, the area was composed of numerous city states that were all fighting for control. However, when the Medici family came back into power, Machiavelli faced persecution, being arrested and charged with conspiracy. When he was released, he wrote The Prince.
Machiavelli did not write The Prince as a work of literary function, even though it has since been largely discussed as such. Rather, Machiavelli wrote The Prince as an appeal to Lorenzo De'Medici. The Prince is written in a straightforward manner, where Machiavelli expounds on his knowledge of Western governments. He gives advice about gaining and maintaining political power. In The Prince, Machiavelli advocates for the idea of having a strong central leader, in order to maintain the benefits to the citizens as a group over the individual.
While Machiavelli wrote in The Prince that a leader should strive to be feared and loved, the two rarely co-existed. Machiavelli continues, saying that a leader should be feared so as to maintain complete obedience over the people he rules. Although, Machiavelli also concedes that if a leader is hated, he will fail. The allegiance of the people is very important, Machiavelli wrote.