To begin with, in order to satisfy
$ \prod_{i=1}^{N}\epsilon_{i}^{n_{i}}=1 $
we must have that, for $S=\left\{ i\backepsilon\epsilon_{i}=-1\right\} $, $ \sum_{i\in S}n_{i} $ is even. Since
$ \sum_{i=1}^{N}n_{i}=M $
we want to enumerate the partitions of M in N parts such that a sum of a subset S of its parts is even. The subset is selected at random, selecting a part if $\epsilon_{i}=-1$ and leaving a part out if $\epsilon_{i}=1$. We don't care about the $n_{i}$ for which $\epsilon_{i}=1$.
Furthermore, in order to satisfy
$ \sum_{i=1}^{N}\epsilon_{i}=0 $
there needs to be the same number of $\epsilon_{i}$ such that $\epsilon_{i}=1$ as there are $\epsilon_{i}$ such that $\epsilon_{i}=-1$, so that N has to be even.
Therefore, the partitions of M into N parts (where N is even) have to be such that a subset of its parts is the partition of an even number. If M is odd, this subset must be strict. And we select parts from the partition of M at random, with a coin toss.
The problem is not solved, but it is framed in terms that could lead to a solution.