The Ultimate Campaign book answers this, aswell as the Familiar entry on the Core Rulebook.
Ultimate Campaign
Sentient Companions: a sentient companion (a creature that can understand language and has an Intelligence score of at least 3) is considered your ally and obeys your suggestions and orders to the best of its ability. It won't necessarily blindly follow a suicidal order, but it has your interests at heart and does what it can to keep you alive. Paladin bonded mounts, familiars, and cohorts fall into this category, and are usually player-controlled companions.
...
An evil campaign where companions are unwilling slaves of the PCs creates a dynamic where the PCs are trying to exploit them as much as possible—perhaps even sacrificing and replacing them as needed—and treat them more like living tools than reluctant allies.
So, the ultimate campaign assumes that familiars and bound animals could become unwilling slaves to their masters and still be under their command and influence.
Finally, the CRB says, on Familiars:
If a familiar is dismissed, lost, or dies, it can be replaced ...
So, the only ways out of servitude are: death, be dismissed, or get lost.
What is lost is subjective. The text talks about the master losing his familiar, such as using it in combat and the familiar goes unconcious and is left behind, or his familiar is captured and they simply don't care about her.
So a familiar could fly away from it's master if you are really pushing it as a GM, but thats not the rules as written.
From my understanding, a familiar is lost whenever the master cannot answer where his familiar is actually located, which seems to be the intent of that rule. But do note that the master and her familiar share an Empathic Link:
Empathic Link (Su): The master has an empathic link with his familiar to a 1 mile distance. The master can communicate empathically with the familiar, but cannot see through its eyes. Because of the link's limited nature, only general emotions can be shared. The master has the same connection to an item or place that his familiar does.
So, they would need to be over 1 mile apart to be considered lost.
Keep in mind that dismissed is undefined aswell, it could go from the master telling her familiar to "go away" or "i release your from my command", to something else that's entirelly not covered by the rules.