Definition. Call two elements of a commutative ring associates iff each divides the other. Call them strong associates if there exists a unit that can be multiplied by the first to yield the second. (In an integral domain, these are equivalent.)
Every element of a commutative ring is the strong associate of at most one idempotent (exercise). Now consider the commutative ring $\mathbb{Z}/6\mathbb{Z}$. Its idempotents are $\{1,3,4\}.$ Hence not every element of this ring is idempotent. However, every element is the strong associate of some idempotent; $2$ is a strong associate of $4$ (since $2 \times 5 = 4$ and $5$ is a unit) and $5$ is a strong associate of $1$ (since $5$ is a unit.)
However, there exist rings in which some elements are not associates of an idempotent, not even weakly. An example is $\mathbb{Z}/n^2\mathbb{Z}$ whenever $n \geq 2.$ Observe that $n$ is not the associate of an idempotent in this ring, not even weakly. Because if it were, then $n^2$ would be an associate of this idempotent, hence $0$ would be an associate of this idempotent, hence this idempotent would be $0$, hence $n$ would be an associate of $0$, hence $n$ would be $0$.
Question. For which $n \in \mathbb{N}$ is it the case that every element of $\mathbb{Z}/n\mathbb{Z}$ is the strong associate of an idempotent? Precisely the square-free ones, perhaps?
(Side question: is there a name for those commutative rings in which every element is the strong associate of some idempotent? These generalize both fields and Boolean rings simultaneously.)