Composite numbers $n>1$, which satisfy $a^{n-1}\equiv 1\pmod{n}$ for all positive integers $a$ with $\gcd(a,n)=1$, are called $\color{red}{\text{Carmichael numbers}}.$
There is a necessary and sufficient criterion for a positive integer to be a Carmichael number known as the Korselt's criterion
$\color{red}{\text{Korselt's Criterion:}}$ A positive integer $n>1$ is a Carmichael number if and only if $(1)$ $n$ is square-free, $(2)$ for any prime divisor $p$ of $n$, $p-1\mid n-1$
Proof: Try yourself. An easy application of Chinese Remainder Theorem
You can verify, using this criterion, that $561$ is a Carmichael number. In fact, there are infinitely many of them.