$x\in \{\{\{x\}\}\}$ or not?
Solution 1:
If $x\in\{\{\{x\}\}\}$, then $x=\{\{x\}\}$, and we have a cycle $x\in\{x\}\in x$. In Zermelo-Fraenkel set theory, this behavior is forbidden by the foundation axiom. So there does not exist any set $x$ such that $x\in\{\{\{x\}\}\}$, no matter how complicated $x$ may be!
(One can study less-popular set theories without the foundation axiom, but I don't know anything about those.)
In your example, you can use the subset relation to model the relationship between Madrid and Spain, instead of the set membership relation. The set of people in Madrid is a subset of the set of people in Spain. If we identify a place with the set of people in that place, then we can simply say that Madrid is a subset of Spain. In that case, we wouldn't say that Madrid is also an element of Spain, because Madrid isn't a person.
Solution 2:
$$x\in\{\{\{x\}\}\}\iff x = \{\{x\}\}$$ The latter is obviously not true for many sets.
Your example of "all people in Madrid are in Spain" is not good here, because, if $\{x\}$ is madrid, then spain would be some set which includes both $\{x\}$ and some other elements
Solution 3:
As many here explained, this certainly don't have to be true, and assuming the axiom of regularity this can be disproved quite easily.
I will remark that it is consistent that the axiom of regularity fails, and that this situation does happen. Of course it would mean that $x=\{\{x\}\}$, but it is a plausible scenario (which, for example, follows from certain "anti-foundation" axioms).
But perhaps one thing missing from the answers here is the mention of a transitive closure. Given a set $X$ we define the transitive closure of $X$ as the set of all elements which can be "reached" by taking elements of elements and so on. The transitive closure of $X=\{\{\varnothing\}\}$ would be to take $X\cup\{\varnothing\}\cup\varnothing=\{\varnothing,\{\varnothing\}\}$, for example.
So while $x$ need not be an element of $\{\{\{x\}\}\}$, it is an element of the transitive closure of $\{\{\{x\}\}\}$.