Let $n\geq 1$ be a natural number. You are looking for those $m\geq 1$ such that $n\equiv m-1 \bmod m$ or, equivalently, $n\equiv -1 \bmod m$, or $n+1\equiv 0 \bmod m$. Hence, you are looking for all divisors of $n+1$.
The function whose values you are trying to calculate is $D(n) = \prod_{d|n+1} d$.
Here are the first few values of $D(n)$, for $n=1,2,\ldots,19$:
$ 2,\ 3,\ 8,\ 5,\ 36,\ 7,\ 64,\ 27,\ 100,\ 11,\ 1728,\ 13,\ 196,\ 225,\ 1024,\ 17,\ 5832,\ 19,\ 8000,$
or in a more enlightening notation...
$ 2,\ 3,\ 4^{3/2},\ 5,\ 6^2,\ 7,\ 8^2,\ 9^{3/2},\ 10^2,\ 11,\ 12^3,\ 13,\ 14^2,\ 15^2,\ 16^{5/2},\ 17,\ 18^3,\ 19,\ 20^3.$
This suggests that $D(n)$ is always a power of $n+1$. Some remarks:
We always have that $n+1$ is a divisor of $n+1$, so $D(n)$ is divisible by $n+1$.
The number $n+1$ is prime if and only if $D(n)=n+1$.
If $n+1 = p^t$, where $p$ is a prime and $t\geq 1$, then
$D(n)=\prod_{d|p^t} d = \prod_{i=0,\ldots,t} p^i = p^{\sum_{i=0}^t i} = p^{t(t+1)/2}=(n+1)^{(t+1)/2}.$
If $n+1=pq$, where $p$ and $q$ are distinct primes, then $D(n)=p^2q^2=(pq)^2=(n+1)^2$.
If $n+1=pqr$, where $p,q,r$ are distinct primes, then
$D(n) = p\cdot q\cdot r\cdot (pq)\cdot (pr)\cdot (qr)\cdot (pqr)=(pqr)^4=(n+1)^4.$
More generally, if $n+1=\prod_{k=1}^s p_i$, where all the $p_i$ are distinct primes, then there is a number $N(s)$ such that $D(n) = (n+1)^{N(s)}.$ And $N(s) = 1 + {s-1 \choose 1} + {s-1\choose 2}+{s-1\choose 3}+\cdots +{s-1\choose s-1}=2^{s-1}.$ Thus, if $n+1=\prod_{k=1}^s p_i$, where all the $p_i$ are distinct primes, then $D(n)=(n+1)^{2^{s-1}}.$
If $n+1=ab$, with $a,b>1$ and $\gcd(a,b)=1$, then $D(a-1)D(b-1)$ is a divisor of $D(n)$, but $D(n)\neq D(a-1)D(b-1)$. Notice that, in this case, we also have that $D(a-1)D(b-1)ab$ is a divisor of $D(n)$, and $D(a-1)D(b-1)ab=D(n)$ if and only if $a$ and $b$ are primes.
If $n+1=pq^2$, where $p$ and $q$ are distinct primes, then: $D(n) = p\cdot q\cdot q^2\cdot pq \cdot pq^2 = p^3q^6 = (pq^2)^3 = (n+1)^3.$