Niccolo Machiavelli was a 16th century Italian diplomat and political theorist, author of The Prince (Il Principe). His short treatise was published in 1532 and has forever secured his fame [or infamy] as the book is singularly responsible for bringing the word “Machiavellian” into usage as a pejorative word in relation social and political dynamics.
The Prince is sometimes claimed to be one of the first works of modern philosophy, especially political philosophy, in which the pragmatic truth is taken to be more important than any abstract ideal.

The general theme of the short text is to accept that the aims of princes – such as glory and survival – can justify the use of any rational means to achieve those ends, without recourse to questions of morality.
He who neglects what is done for what ought to be done, sooner effects his ruin than his preservation.
The Prince starts by defining the “state” to mean,
all forms of organization of supreme political power, whether republican or princely.
He then clearly distinguishes new princedoms from hereditary established princedoms, by saying that hereditary ones are much easier to rule. For such a prince,
unless extraordinary vices cause him to be hated, it is reasonable to expect that his subjects will be naturally well disposed towards him.
This is opposed to his advice to new princes, for whom as the
… new ruler who will need to establish himself in defiance of custom.
Conquests by “criminal virtue” are ones in which the new prince secures his power. Machiavelli advises that a prince should carefully calculate all the wicked deeds he needs to do to secure his power, and then execute them all at once, such that he need not commit any more wickedness for the rest of his reign. In this way, his subjects will slowly forget his cruel deeds and his reputation can recover.

Lorenzo di Piero de’ Medicito whom the final version of The Prince was dedicated.
Since there are many possible qualities that a prince can be said to possess, he must not be overly concerned about having all the good ones. A prince may be perceived to be merciful, faithful, humane, frank, and religious, but most important is only to seem to have these qualities. A prince cannot truly have these qualities because at times it is necessary to act against them.

In addressing the question of whether it is better to be loved or feared, Machiavelli writes,
…it is far safer to be feared than loved if you cannot be both.
Fear is simply a means to an end, and that end is security for the prince. The fear instilled should never be excessive, for that could be dangerous to the prince.
Machiavelli notes that a prince is praised for keeping his word. However, he also notes that a prince is also praised for the illusion of being reliable in keeping his word. A prince, therefore, should only keep his word when it suits his purposes, but do his utmost to maintain the illusion that he does keep his word and that he is reliable in that regard.

As Machiavelli notes,
He should appear to be compassionate, faithful to his word, guileless, and devout. And indeed he should be so. But his disposition should be such that, if he needs to be the opposite, he knows how.
In summary, to answer the titular question, ‘What would Machiavelli do?’ one may well surmise he would above all, do what needs to be done…
…for a man who strives after goodness in all his acts is sure to come to ruin, since there are so many men who are not good.