As K9 says, Machiavelli has an unjustly bad reputation, which is due to a misunderstanding of his work.

On the one hand, The Prince could be considered a handbook for dictators. On the other, Machiavelli strongly argued that the prince should not be hated by the people (as this is likely to lead to his downfall). While this does not change how the dictator got power, it does mean that said prince is not going entirely against the will of the people. Machiavelli did not advocate autocracy, particularly autocracy over a resentful and hostile people. Machiavelli did not actually advocate the idea that the end justifies the means; rather, he considered that the end, if good (i.e. a stable, free republic) excused the means. There is a difference.

It should also be considered that Machiavelli was, above all, a pragmatist. Like many socialists (Lenin, for example), he believed in the necessity of strong leadership (some would say tyranny) to create a republic in which people worked for the common good. The Prince is simply advice on how to keep the position of the strong leader; Machiavelli believed in doing what was necessary, rather than what was considered virtuous in Christian terms. His idea of doing what was necessary did not include gratuitous cruelty.

Focus has always been on The Prince, rather than Machiavelli's Discourses, which does lead to a skewed impression of his ideas. Machiavelli was committed to the idea of a republic. His vision of a united, stable, republican state, where people work for the common good rather than individual advancement, can be seen as near-communist. It seems utopian, a far cry from Machiavelli's traditional image of 'how to get the top job and influence people'.

Another problem with the traditional view was that Machiavelli was deeply suspicious of those who worked for personal glory. His ideal world would include bonuses for those who worked for the public good and penalties for those who worked for personal ambition. Again, this is in contrast to the view that Machiavelli wrote a handbook for people who wanted total power at the expense of the rest of the population.