I encountered problems of the type $$\max_p\mathbb{E}_p f$$ where $p = (p_i)_{i=1}^n$ is a discrete probability distribution, $p_i\geq 0$, $\sum_i p_i=1$, $\mathbb{E}_p$ is the expectation w.r.t. $p$, and f is some vector $f\in\mathbb{R}^n$. The solution is $$\max_p\mathbb{E}_p f = \max \{f_i\}\quad .$$ Intuitively, pick the distribution that puts all weight on the largest entry in $f$. Any other choice gives a smaller expectation. So far so good.
Now comes the interesting part: Restrict the eligible distributions to some set $\mathcal P$: $$\max_{p\in\mathcal P}\mathbb{E}_p f$$ Is there any closed form solution to this?
Maybe something can be said if the set $\mathcal P$ is narrowed down to $\mathcal P=\{p\,|\,\mathbb E_p g_j=0, j=1\dots m\}$, i.e. the subset of all distributions that make $m$ expectations vanish.
If we denote $p\in \mathcal P$ as a vector in $\mathbb R^n$, then $\mathbb E_pf$ can be written as $p^Tf$. Hence our optimization problem becomes $$\begin{align*}&\max p^Tf \\\text{s.t.}& \sum_{i=1}^n p_i = 1 \\ &p_i\geq 0\end{align*}$$ This is known as a linear optimization or linear programming problem.
If we add the constraints $\mathbb E_pg_j=0$ for some $g_1,\dots, g_m\in\mathbb R^n$ our optimization problem becomes $$\begin{align*}&\max p^Tf \\\text{s.t.}& \sum_{i=1}^n p_i = 1 \\&p^Tg_j=0 , \hspace{1cm}j=1,\dots,m\\ &p_i\geq 0,\hspace{1cm} i = 1,\dots,n\end{align*}$$ which still is a linear optimization problem. There's no closed form solution to this problem in general (i think), but there's extensive amounts of theory regarding such problems, including efficient algorithms to solve these problems. See here for an overview.
For even more general constraints $\mathcal P$ this problem might get more difficult, but if the constraints are given by convex functions, you still have a convex optimization problem. For such problems there still are nice characterizations of optimal solutions, see e.g. the Karush-Kuhn-Tucker theorem.