One of the oft-recurring elements in cape-and-sword stories is the relationship of the main characters to power and powerful individuals, often historical figures, in the setting. In The Three Musketeers romances, d'Artagnan is involved in the affair between the Queen-Consort and the Duke of Buckingham, then serves the Queen-Regent and her first minister, Cardinal Mazarin, during the Fronde, and finally is Captain of the Musketeers under Louis XIV. Gil de Berault is known to Cardinal Richelieu and tasked with acting as the Cardinal's spy against a Huguenot rebel in Under the Red Robe. Captain Alatriste, through his relationship with two courtiers of King Felipe IV, performs a variety of missions on behalf of the Spanish crown; he is also known to the Geneose general, Ambrogio Spinola, under whom Alatriste served on a number of campaigns. The Anglo-Dutch mercenary Percy Blake - ancestor of his namesake concealed behind the mask of the Scarlet Pimpernel - thwarts a plot to kill the Stadtholder, Maurice of Nassau, in The Laughing Cavalier.
The relationship of swashbucklers to persons of note carries into fictional settings as well, as in the relationship between distant cousins Rudolf Rassendyll and King Rudolf V Elphburg of Ruritania.
I could go on, but I think you get the idea.
Introducing this element in cape-and-sword roleplaying games can be pretty easy for the referee and the players. For example, it can addressed through character generation in some systems. In Flashing Blades, player characters make take Advantages and Secrets such as Contact, Favor, or Secret Loyalty, establishing a relationship between the adventurer and a notable figure from the beginning of the adventure or campaign. 7th Sea offers similar Advantages to the adventurers, such as Connections, Patron, and Membership, selected during character creation.
Relationships between the adventurers and powerful non-player characters can also develop in actual play, of course. In more linear, plot-driven adventures, these influential figures may engage the adventurers to perform a service, possibly through the relationships established in their Advantages, or more directly, such as a secret summons or perhaps to escape punishment for an offense like dueling in defiance of royal edicts or courting the wrong man's mistress. In a more player-driven, sandbox campaign, rumors may offer leads to powerful figures in the setting, or the players may attempt to build a connection, such as seeking an introduction, presenting gifts or bribes, and offering service in exchange for patronage.
In my Flashing Blades sandbox campaign, I've populated different random encounter lists with named non-player characters, to give the adventurers an opportunity to spontaneously meet and occasionally serve some of the most influential figures in early 17th century France. The adventurers, for example, rescued the duchesse de Chevreuse and her lover, Lord Holland, from an attack by bravos in a Parisian alley, they danced with the ladies-in-waiting of Cristina Maria, the princess of Piedmont, and one of them is about to be decorated by the duke of Savoy for his service on military campaign.
So establishing relationships to power isn't necessarily difficult. Managing them as the campaign goes on requires some care, however.
First, the adventurers may be tempted to treat the non-player character as at their beck-and-call. In my experience, this is often by no means deliberate; it can actually arise from smart play and it's often perfectly fitting for the adventurers to seek assistance. Following a duel-gone-bad involving the Cardinal's Guards in our campaign, the players quickly ran down the list of non-player characters their characters knew in order to get access to the King before the Cardinal did. However, access to power should ideally come at a cost. In the case of relationships created through Advantages during chargen, the rules of the game may provide reasonable limites on the kinds of assistance which can be expected from a powerful non-player character. For example, the Advantage Contact in Flashing Blades indicates that the Contact will, "aid the character in times of need," but adds the caveat that a Contact, "will help less often the higher their [social] rank." A character with the Favor Advantage runs the risk of retaliation if the favor asked is "too great." In these cases, the rules provide a check-and-balance on the benefit provided by the Advantage.
With respect to adjudicating relationships between influential npcs and the adventurers which arise from actual play, it's important to remember that powerful non-player characters are powerful within the setting for a reason. They may hold important positions, command clients and servants, and control considerable wealth. The most basic guideline for roleplaying this relationship is quid pro quo - what are the adventurers prepared to give up in exchange for power exerted on their behalf? Imbalances in power relationships tend to drive the action in my games - put simply, if the adventurers are winning, then someone somewhere is losing, creating a dynamic balancing of assistance and influence. The adventurers should rarely get something for nothing in their interactions with the elite figures of the campaign. This doesn't mean that non-player characters should not act generously toward the adventurers, but such generosity should carry at least some expectation of reciprocity.
Second, the rules for social interactions in the game need to be considered carefully. It's not difficult to see how a player who optimizes a 'Face' character might be tempted to reduce an important figure in the game to a lapdog through incautious refereeing. Referees must be familiar with the ins-and-outs of how these skills work in their games, and what the characters can actually expect to accomplish from their use. For example, in d20 games there are limitations on when and how the Diplomacy skill can be used, such as requiring at least a full minute to make a pitch and allowing opposed rolls in negotiations and pleadings. I use opposed rolls, for example, when an adventurer is attempting to persuade an underling to perform an act on the adventurer's behalf, such as convincing a guard or a clerk to ignore their master's orders - the opposed roll is between the more powerful non-player character's skill and the adventurer's, rather than against a static DC.
In my Flashing Blades campaign, I use the difference in Social Rank betweeen player and non-player characters as a modifier to skill checks involving Etiquette, Oratory, or Captaincy, as well as opposed rolls with a patron's Social Rank and skill standing in for that of a client or créature like a lackey.
Game with magic make this particularly dicey - pun intended - and the referee should carefully consider what defensive magics a powerful and influential figure in the setting is likely to routinely employ to ward against enchantment magic.
None of this should be taken as a recommendation to swing the nerf-hammer at the first sign of the adventurers gaining an upper hand. Few things suck harder as a player than discovering that using the skills and abilities you developed over the course of the game are constantly blunted by the referee. Rather, it's another reminder that powerful npcs should be treated as powerful, not push-overs. Consider the results of successful skill checks in light of the quid pro quo outlined above - how can a non-player character who loses an opposed skill check give the players the reaction they've earned in actual play while gaining something for themselves in the exchange?
Third, the referee needs to be prepared to answer the question, what happens if the adventurers off an important, powerful non-player character? Some referees may choose to give influential, particularly historical, non-player characters some sort of story immunity to insure that historical or setting continuity is maintained. A 7th Sea game master, for example, could rule that the Empereur cannot be killed by the adventurers, though he may be inconvenienced; should the adventurers succeed in an attack on that curled and perfumed royal head, they could discover that they only defeated a look-alike standing in for his imperial majesty.
Others - myself included - prefer to let the dice fall where they may. For my campaign, I've considered what happens should Cardinal Richelieu, for example, or King Louis XIII die unexpectedly in the course of actual play. Part of my campaign preparation involves the possibility of spinning off into alt.history, particularly given that the career rules of Flashing Blades give the adventurers the opportunity to rise to positions of great power and responsibility themselves in the course of a campaign, potentially supplanting Mazarin or Turenne or Colbert.
In my experience, creating and building these relationships between the player characters and important non-player characters is fundamental to emulating the cape-and-sword genre. Players who enjoy swashbuckling tales are likely to find even a passing encounter with a famous character memorable, but the relationships they build and exploit with powerful non-player characters are the stuff that may drive an entire campaign.