I have a theorem of the following scheme: $Q \Leftrightarrow \exists x\in Z: P(x) \Leftrightarrow \forall x\in Z: P(x)$. How to simplify it (not to write $P(x)$ twice)?
Your question is ambiguous as you have written it, since it isn't clear if you mean to say that $Q$ asserts the biconditional, or that all three statements are equivalent, or that $Q$ is your theorem and it is asserting the equivalence of the other two clauses. These are distinct assertions. Many mathematicians write $P\iff Q\iff R$, when what they mean is $(P\iff Q)\wedge(Q\iff R)$. The waters are muddied further by the question of whether $Z$ is nonempty and whether you want the assertion to imply that or not.
If you mean to mean to say $[Q\iff (\exists x\in Z\ P(x))]$ and $[Q\iff \forall x\in Z\ P(x)]$, then my suggestion would be:
But what you wrote could also be interpreted as $Q\iff[(\exists x\in Z\ P(x))\iff (\forall x\in Z\ P(x))]$, in which case my suggestion would be:
That formulation presumes $Z$ is known to be non-empty in advance. If you want this to be part of the assertion (part of $Q$?), then it would seem that you want:
Finally, perhaps you mean just that $Q$ is your theorem, and it asserts the equivalence of the other clauses. (Note that $Q$ does not appear in Joriki and user6312's answers, who evidently interpreted your question this way.) In this case, of course, you don't need to mention $Q$. So if your theorem simply is $[\exists x\in Z\ P(x)]\iff [\forall x\in Z\ P(x)]$, then I suggest:
Using semi-formal notation, one could write
$$(\forall x, y \in Z) (P(x) \longrightarrow P(y))$$
There are more formal (but less readable) ways of writing the same thing.
I think most people would write something like the following:
By the same token, I think most readers would find this easiest to read (because they are used to seeing such statements), rather than having to decode some clever logical statement.
If $P(x)$ stands for a long and complicated condition that you don't want to write out twice, I'd introduce some auxilary definition or notation. (Also, that way readers won't have to check that 2 and 3 really contain the same condition.)