To Prof. Young,
The function of "comments" has the limitation on the number of words, so I write my ideas here.
Sorry, there is a serious mistake in my upper bound. In fact my argument yields $N^{2k-1}(N/q+1)(M+q\log q)$ with is just the same with yours up to a log facor. Here is the detail.
$$THE~~SUM=\mathop{\sum\sum}_{n_1,\cdots,n_{2k}\leqslant N}\sum_{m\leqslant M}e\left(\frac{pm((n_1+\cdots+n_k)-(n_{k+1}+\cdots+n_{2k}))}{q}\right)
$$
$$\ll\mathop{\sum\sum}_{n_1,\cdots,n_{2k}\leqslant N}\min\left(M,\left\|\frac{p((n_1+\cdots+n_k)-(n_{k+1}+\cdots+n_{2k}))}{q}\right\|^{-1}\right)$$
$$\ll\sum_{a\bmod q}\min\left(M,\left\|\frac{q}{a}\right\|^{-1}\right)\mathop{\sum\sum}_{\substack{n_1,\cdots,n_{2k}\leqslant N\\(n_1+\cdots+n_k)-(n_{k+1}+\cdots+n_{2k})\equiv \overline{p}a(\bmod q)}}1.$$
Since the summations over $n_i$ are bounded by
$N^{2k-1}(N/q+1)$ for each $a\bmod q$, we can conclude the estimate
$$\ll N^{2k-1}(N/q+1)\sum_{a\bmod q}\min\left(M,\left\|\frac{q}{a}\right\|^{-1}\right)\ll N^{2k-1}(N/q+1)(M+q\log q).$$