Solution 1:

Perhaps a simple example can illustrate things better?

Say a typical bullock has probability $0.7$ of weighing between $1$ and $2$, and probability $0.3$ of weighing between $2$ and $3$. A bullock that weighs $1$ sells for $\$200$, and a bullock that weighs $2$ sells for $\$300$ (i.e. $g(1)=\$200$ and $g(2)=\$300$). How can we use this to calculate the typical bullock price?

Making the (very simplifying) assumption that all bullocks between $1$ and $2$ sell for $\$200$ and all bullocks between $2$ and $3$ sell for $\$300$, we get $$ \text{typical price}\approx 0.7\cdot\$200+0.3\cdot\$300=\$230 $$ Ok. But that weight distribution was very coarse. Let's improve it. Say a bullock has probability $0.2$ to weigh between $1$ and $1.5$ and probability $0.5$ to weigh between $1.5$ and $2$. Further that it has probability $0.25$ of weighing between $2$ and $2.5$ and probability $0.05$ of weighing between $2.5$ and $3$.

Say the price for a $1.5$ bullock is $\$250$ and the price for a $2.5$ bullock is $\$400$. Then by a similar simplification and the same logic, the typical price is approximately $$ 0.2\cdot\$200+0.5\cdot\$250+0.25\cdot\$300+0.05\cdot\$400=\$260 $$ Assuming some niceness about the price function $g$ (usually continuity), we see that as we keep subdividing the weight intervals we look at, we will get better and better results.

This is the exact idea behind the Riemann sum in that argument. The only detail I've left out is how to get the probabilities. These don't appear directly in your $\sum g(w_i)f(w_i)\Delta w_i$. But $f(w_i)\Delta w_i$ is an approximation to this probability, which also gets better and better as we keep subdividing the weight intervals. After all, that's one of the more common way to make sense of what the values of a probability density function like $f$ mean in the first place.