I generally find it important to lay out a few things for any organization, secret or not: what are their motivations for existing, how do they interact with the rest of the world, how did they form, and how did their history help shape who they are today?
The main thing is to avoid a cookie cutter organization that isn't tied to its surroundings. If your organization could be removed from the context you want to put it in and placed somewhere else without modifying any of the background of your story, it's probably not a well though out organization.
Consider the Templars, for example. On a surface level, they're an order of holy knights. However, their story is deeply ingrained into the history of the Crusades and of middle-ages Catholicism. They were created as a result of banditry and highway robbery targeting pilgrims, and gained support from Bernard of Clairvaux, which led to them being held in high esteem by both the Catholic church and European aristocracy. Their status as a popular charity during the middle ages led to great wealth and power.
Wealth and power and a mission to protect pilgrims put the knights in an ideal position to safeguard the possessions of pilgrims in their fortresses, which led to their becoming a prominent bank.
Another 'secret' organization worth looking at is the Sicilian Mafia in new your. Again, they have a reason for existing (to effectively commit more crime), relations with both their fellow criminal organizations as well as the countries of Italy and the United States, and a rich history which roots their origins as 'protectors' in post-feudal Sicily when the government was too weak to enforce contracts between a vastly increased number of landowners and social turmoil was leading to an increase in crime.
These details give the mafia a reason for existing, as well as contextualizing why they ally with which other groups.
It's also important to note that, for both the Templars and the Sicilian Mafia, their existence was strongly tied to the historical context in which they formed. They did not arise from the ether at some point in history at the behest of a powerful individual, but rather were reactions to the social conditions of their day and age. These origins give them a reason for existing, though their origins don't fully define them as their interactions with other groups through their history constantly change them, or, in the case of the Templars, destroy them.