There are four i.i.d. random variables, $\{X_i\}^4_{i=1}$, with the following distribution:
\begin{array}{|c|c|c|c|} \hline \text { Values } & -2 & 0 & 2 \\ \hline \text { Probabilities } & 1 / 4 & 1 / 2 & 1 / 4 \\ \hline \end{array}
Let $f(x)$ denote the probability of $\{X_i=x\}$ and $F(\cdot)$ the CDF of the above distribution.
I want to calculate $Pr(rank(X_1)=1)$, i.e. the probability that there is no $X_i$ strictly greater than $X_1$ and $Pr(rank(X_1)=2)$, i.e. there is one $X_i$ weakly greater than $X_1$ and the rest are weakly less than $X_1$.
\begin{align} &Pr(rank(X_1)=1)\\ &=\sum\limits_xPr(rank(X_1)=1,X_1=x)f(x)\\ &=\sum\limits_xF(x)^3f(x)\\ \end{align}
\begin{align} &Pr(rank(X_1)=2)\\ &=\sum\limits_xPr(rank(X_1)=2,X_1=x)f(x)\\ &=\sum\limits_x Pr\left[\underbrace{(X_2 \geq X_1 \geq \max\{X_3,X_4\})}_{A}\cup\underbrace{(X_3 \geq X_1 \geq \max\{X_3,X_4\})}_{B}\cup \underbrace{(X_4 \geq X_1 \geq \max\{X_3,X_2\})}_C\right]f(x)\\ &=\sum\limits_x (\underbrace{Pr(A)+Pr(B)+Pr(C)}_{3(1-F(x)+f(x))F(x)^2}-\underbrace{(Pr(A \cap B)+Pr(A \cap C)+Pr(B \cap C))}_{3f(x)^2F(x)}+\underbrace{Pr(A \cap B \cap C)}_{f(x)^3})f(x)\\ \end{align}
Explanation of the last line: $A \cap B \implies X_2 \geq X_1 \geq X_3$ and $X_3 \geq X_1 \geq X_2$, combining, $X_1 = X_2 = X_3 \geq X_4$. Similarly the others. Therefore we have:
\begin{align} &Pr(rank(X_1)=2) = \sum\limits_x \left[3((1-F(x)+f(x))F(x)^2-f(x)^2F(x))+f(x)^3\right]f(x) \end{align}
Alternatively if we define the event $\{rank(X_1)=2\}$ as exactly one $X_i$ is strictly greater than $X_1$, we have:
\begin{align} &Pr(rank(X_1)=2) = \sum\limits_x 3(1-F(x)F(x)^2f(x) \end{align}
Kindly let me know if these calculations are correct. Thanks in advance.