Let $p=x$ where $a^x \equiv 1\pmod N$. When $N$ is prime I can check whether $p=N-1$ and if it is, there are a full set of remainders. However, if $p<N-1$, I need to keep checking. For example, if $N=11$ and $a=3$ the following powers are generated:
$3^1 \pmod {11} =3 \\ 3^2 \pmod {11} =9 \\ 3^3 \pmod {11} =5 \\ 3^4 \pmod {11} =4 \\ 3^5 \pmod {11} =1 \\ 3^6 \pmod {11} =3 \\ 3^7 \pmod {11} =9 \\ 3^8 \pmod {11} =5 \\ 3^9 \pmod {11} =4 \\ 3^{10} \pmod {11} =1 $
$3^{10} \pmod {11}$ doesn't represent the smallest exponent where $a^x \equiv 1\pmod N$ because equivalent powers exist (e.g. $3^6 \equiv 3^1 \pmod {11}$. The least positive exponent where $a^x \equiv 1\pmod N$ is $5$. So $p<N-1$. What I'm trying to figure out is why only divisors of $φ(N)$ are capable of $a^x \equiv 1\pmod N$, why can't $7$ be a possible exponent that returns $1$?
Let $(a,m)=1$. Then the smallest natural number $h$ such that $a^h\equiv1\mod m$ is called the order of $a\mod m$, denoted as $O(a)\mod m$. It can be shown that$$h'\in\Bbb N:a^{h'}\equiv1\mod m\implies h|h'$$where $h$ is $O(a)\mod m$. This is because $h'=qh+r,0\le r<h\implies a^{h'}=a^{qh+r}\equiv a^r\equiv1\mod m$.
If $r\ne0$, we would have found an integer $r$ less than $h$ such that $a^r\equiv1\mod m$. But this is not possible, since $h$ is the minimum such natural. Thus, $r=0$.
In addition to this, it is easy to see that any multiple of $h=O(a)\mod m$ will be congruent to $1\mod m$.
Now you may recall from Fermat's Little Theorem that for prime $p$ and $a$ coprime with it, $a^{p-1}=a^{\varphi(p)}\equiv1\mod p$. Thus, $O(a)\mod p$ must divide $\varphi(p)$.