Historically, how do these current city-states manage to stay independent, and not absorbed/annexed by their neighboring countries?

by sippher

Especially city-states that were surrounded by countries that are historically known for unification wars, or annexations, or colonizations, imperialisms, invasions, etc.

On top of my head:

San Marino, Andorra, Singapore, Brunei, Qatar, Monaco, Liechtenstein, Bahrain, Kuwait...

I just watched a video about Italy's history and how it went through a unification war, and I was like... so did they just ignore that one small city...? And how it was conquered by foreign empires, and so did those empires ignore San Marino and only conquered the Italian region?

I know they managed to survive through different reasons, I want to know about them all.

EdHistory101

Sorry, we don't allow "example seeking" questions. It's not that your question was bad; it's that these kinds of questions tend to produce threads that are collections of disjointed, partial, inadequate responses. If you have a question about a specific historical event, period, or person, feel free to rewrite your question and submit it again. If you don't want to rewrite it, you might try submitting it to /r/history, /r/askhistory, or /r/tellmeafact.

For further explanation of the rule, feel free to consult this META thread.