Scheduling insurance
Scalpers absorb the time risk associated with events and the risk associated with scheduling issues (whether or not fans can attend an event or buy something in limited stock)
They also absorb the risk that unfavorable events could occur (for instance, ticket resale values dropping after a sports team has a few losses on its record)
The opportunity for profit is good for fans because it ensures that things in limited supply will be made available in situations where demand is high, for instance, if a sports team does unexpectedly well
For instance, season ticket holders also profit from scalpers because, should something unavoidable arise, they can sell their tickets to scalpers, providing liquidity for these season ticket holders, giving them the ability to recoup some or all of their ticket costs in a financial tight spot. These factors also increase customer willingness to purchase season tickets in the first place, being a major benefit to the sports teams.
Scalping is caused by a fixed, invariable supply of something. If the supply could increase with increased demand, scalpers would be totally displaced.
A second necessary condition for scalping is the appearance of a list price or MSRP. If a stipulated price was not there, scalping by definition could not occur.
Consider shares in the stock market. No matter how many you buy, no matter for how long you hold them, now matter at how high the price is when you resell them, they cannot be "scalped".
The third condition necessary for scalping is that the listed price is lower than the "market clearing price". The market clearing price is the price at which everybody who is willing to buy for that price finds an owner who is willing to sell for that price, and vice versa.
When the listed price is lower than that, it means that there are more customers willing to buy the item than there are items available. This imbalance sets forces in motion trying to correct it. Would-be purchasers begin to try harder to obtain the items. Some of them become willing to pay more than the listed price. Prices rise, and the original imbalance is corrected as these higher prices cause a drop in demand.
In other words, scalpers are the solution to the problem of rationing the few items among the many claimants.
If you need me to, I'll go deeper into the economic logic to explain this.