Let $f \colon \mathbb R^N \to \mathbb R$ be a measurable, bounded function. Let $$ \mathcal A := \left\{ g \colon \mathbb R \to [0,+\infty): g \text{ is measurable and} \int_\mathbb R g =1\right\}. $$
What is the value of $$ M:=\sup_{g \in \mathcal A} \int_{\mathbb R^N} f(x_1,\ldots , x_n) g(x_1) g(x_2) \ldots g(x_N) d\mathcal L^N(x_1, \ldots , x_N)? $$ Is the sup attained?
Consider $E=\{(x_1,...,x_n):|f(x_1,...,x_n)| <M\}$. If $\int_{\mathbb R^{N}} I_E (x_1,...,x_n) g(x_1)g(x_2)...g(x_n)\, dx_1\, dx_2...\,dx_n >0$ then $M <\|f\|_{\infty}$. If $g>0$ everywhere then this says that $M <\|f\|_{\infty}$ whenever Lebesgue measure of $E$ is positive. Condition for equality depends on $f$ as well as the support of the measure $g(x_1)g(x_2)...g(x_n)\, dx_1\, dx_2...\,dx_n$