Assume $3$ players are rolling a $n$-sided dice. And as the $4$-th player, you can choose an integer $1 \leq x \leq n$. Now after the rolling, the players with the highest/lowest numbers, as well as the two middle ones, team up. The team with the greater sum of the rolls pays the the team with the lower sum the difference of their sums. For example, suppose the rollings are $48, 50, 2, 10$, then the team $48, 10$ need to pay $50, 2$ an amount of $6$.
Which $x$ do you pick to maximize your expected value, and what expected value is it?
My attempt: For simplicity first consider uniform distribution on $[0,1]$. Suppose you choose $x$, there are $4$ cases: $x$ being lowest, second lowest, second greatest, and the greatest.
Lowest. Probability $(1-x)^3$, $$EV = \left( \frac{2(1-x)}{4} + x + \frac{(1-x)}{4}+x \right) - \left(\frac{3(1-x)}{4}+ x + x\right) = 0$$
Second to lowest. Probability $x(1-x)^2$, $$EV = (\frac{x}{2}+x+\frac{2(1-x)}{3} ) - (x+x+\frac{(1-x)}{3})=\frac{1}{3}-\frac{5x}{6}$$
Second to highest. Probability $x^2(1-x)$, $$EV= (x + \frac{1-x}{2}+\frac{x}{3})-(x+\frac{2x}{3}) = \frac{1}{2} - \frac{5x}{6}$$
$EV = 0$ by symmetry.
Thus it suffices to find $x$ that maximize
$$x(1-x)^2(\frac{1}{3}-\frac{5x}{6})+x^2(1-x)(\frac{1}{2} - \frac{5x}{6}) = \frac{x(x-1)(2x-1)}{3}$$
And thus $x \approx 0.211$ solves the maximum, with EV being $0.016$
So choosing $x$ to be approximately the rounding of $0.211n$ would give the answer and expected profit of $0.016n$. But I'm not sure of an exact solution.
The case where $n=50$ was a Jane Street Capital interview question. I am interested in the general case.
Assume that $x$ is the value that you choose and $L$, $M$ and $U$ the lowest, middle and highest values choosen by other players. I am also assuming that when $x$ is equal to the lowest or the highest, you will team with the middle such that you are winner. Your gain is:
\begin{align} G(x) &= \left(U + M - L\right)\mathbf 1_{U < x} + \left(U + L - M\right)\mathbf 1_{L \le x \le U} + \left(L + M - U\right)\mathbf 1_{x < L} - x\\ &= U\left(2\times\mathbf 1_{L \le x} - 1\right) + M\left(1 - 2\times \mathbf 1_{L \le x \le U}\right) + L\left(2\times\mathbf 1_{x \le U} - 1\right) - x \end{align}
So
\begin{align} G(x+1) - G(x) &= 2U\left(\mathbf 1_{L \le x+1} - \mathbf 1_{L \le x}\right) + 2M\left(\mathbf 1_{L \le x \le U} - \mathbf 1_{L \le x+1 \le U}\right) + 2L\left(\mathbf 1_{x+1 \le U} - \mathbf 1_{x \le U}\right) - 1\\ &= 2\left(U\mathbf 1_{L=x+1} - M\mathbf 1_{L=x+1} + M\mathbf 1_{U=x} - L\mathbf 1_{U=x}\right) - 1\\ &= 2\left((U-M)\mathbf 1_{L=x+1} + (M-L)\mathbf 1_{U=x}\right) - 1 \end{align}
Since $(L, M, U)$ and $(n-U+1, n-M+1, n-L+1)$ have the same probability law then, \begin{align} E\left[(U-M)\mathbf 1_{L=x+1}\right] &= E\left[((n - L +1)-(n- M+1))\mathbf 1_{n-U+1=x+1}\right]\\ &= E\left[(M-L)\mathbf 1_{U=n-x}\right] \end{align}
Let \begin{align} F(x) &= E\left[(M-L)\mathbf 1_{U=x}\right]\\ &= \frac1{n^3}\sum_{i=1}^n\sum_{j=1}^n\sum_{k=1}^n (M(i,j,k) - L(i,j,k))\mathbf 1_{U(i,j,k)=x}\\ &= \frac1{n^3} \left(6\sum_{1\le i \le j < x} (j-i) + 3\sum_{1\le i < x}(x-i)\right)\\ &= \frac3{n^3}\left(2\sum_{1\le i \le x-1}\sum_{j=0}^{x-1} j + \sum_{1\le i \le x-1} i\right)\\ &= \frac{3}{n^3}(2x-1)\sum_{i=1}^{x-1}i\\ &= \frac{3}{2n^3}x(x-1)(2x-1). \end{align}
\begin{align} E\left[G(x+1)-G(x)\right] &= 2(F(n-x) + F(x)) - 1\\ &= \frac{3}{n^3}(n-1)\left(6x^2 - 6nx + n(2n-1)\right) - 1 \end{align}
You can study the sign of the function $E\left[G(x+1)-G(x)\right]$ to find the value that maximise $E[G(x)]$.