The low-detail version of this is that the military strength you have in the vicinity of a city state will determine how threatened they feel.
If you click into the option to demand tribute (there is a choice to make between extorting gold or extorting a worker from them, so there's a sub-menu before anything actually happens), you can mouse over each option and it gives an accounting of the factors that play into whether they feel threatened enough to give tribute. You can also mouse over the CS's city label on the main map to see a tooltip which will mention whether they will cave in if you demand tribute, but it doesn't list the factors that go into it.
I don't know all of the factors, but I think being a military CS gives them a bonus, already being extorted recently gives them a bonus, and probably being under a civ's protection gives them a bonus. Demanding a worker also gives a bonus to resist as compared to demanding gold.
So, the basic idea is that you move enough of your stuff next to them until the threat you pose outweighs their resistance to tribute demands. If you are successful, you get whatever you demanded and your influence with them drops some. From what I could tell, demanding tribute doesn't incur warmonger penalties with AI civs, except that any civs who were protecting that CS may get mad at you (a penalty that decays with time).