Vickrey Auction question
Optimal allocation refers to whom the seller awards the item, in order to maximize revenue. In a Vickrey auction, it is a Nash equilibrium for everyone to bid their valuations. This is stronger than a Bayesian Nash equilibrium, which is the solution concept in Bayesian games (which include auctions). The Bayesian Nash equilibrium is the solution concept in which every player seeks to maximize their expected utilities, subject to their respective beliefs about the world. In the Vickrey auction, agents' beliefs about the world do not really matter.

The goal of the Vickrey auction is to illicit truthful responses from the agents. That is, they bid their precise valuations. The first-price auction is revenue-equivalent to the Vickrey auction; however, agents do not truthfully bid their valuations.

In particular, if we have a symmetric $n$-player auction where players' valuations are drawn from a probability distribution $F([0, \omega])$ with density $f$, we have the expected revenue for the seller as:

$$n \cdot \int_{0}^{\omega} (n-1) \cdot y \cdot f(y) \cdot F^{n-2}(y) \cdot (1-F(y)) dy$$

Combinatorially, we select the highest two bidders in $n(n-1)$ ways, since order matters. Suppose the second highest bid is $y$. This occurs with probability $f(y)$. The remaining $n-2$ players bid less than $y$ with probability $F^{n-2}(y)$. The highest bidder has valuation greater than $y$ with probability $1-F(y)$. Each of these selections are independent; so by rule of product, we multiply. As this is an expected value, we include $y$ in each product. By rule of sum, we add up over each possible value of $y$ (hence, the integral).