Florence in the late 1400s, when Machiavelli first entered the political world, was a beehive of a place, buzzing with activity. Scheming politicians rubbed shoulders with aspiring artists, while towers rose and philosophical treatises hit the presses. The city was a booming commercial center and more or less the capital of Tuscany. Florence, a republic for as long as we have records of the city (since around 1,000 AD) held sway over the Tuscan cities that surrounded it: Siena, Pisa, San Gimignano, Pistoia, and others.
The Medici family ruled Florence for much of the 15th century, and theirs was in some ways an authoritarian rule. That said, the Medicis never entirely abolished the city's representative government. Pietro Medici was run out of the city in 1494, and shortly thereafter Machiavelli rose to prominence. The greatest menaces to Florentine republicanism were now in exile, and Machiavelli was free to exercise his talents.
Piero Soderini, named gonfalnier in 1502, brought a greater degree of stability to Florence than it had known in quite some time. This may have tempered some of the more turbulent aspects of the city's politics, but it certainly did not mute them. Florence at the time possessed one of the most vibrant political scenes in all of Europe. Most officials were limited to short terms, and therefore election campaigns were nearly constant, and often overlapping. Among the numerous parties and factions were religious reformers, the Guelfs (anti-German and tolerant of the Pope), and the Ghibellines (pro-German and anti-Papacy). Guilds were active in politics, and Florentines of every class were politically conscious. Within this melee, Machiavelli found plenty of fodder for his written works. Indeed, The Prince reflects in more ways than one the city in which many of its ideas were conceived. Machiavelli, even when in exile, was always a Florentine at heart, and The Prince is not just a quintessential Renaissance text, but a Florentine work par excellence.