What is the actual threat of a majority attack on the Bitcoin blockchain? As far as I understand, an attacker (in the role of a malicious miner) controlling a large portion of the current hash power could replace previously accepted blocks with alternatives.

But, what does that mean? He could


Collect the block reward
Add previously unconfirmed transactions, making them confirmed
Omit formerly confirmed transactions


But what would an attacker gain with this?


Block rewards are easier collected with real mining
Unconfirmed transactions may eventually confirm anyway
Omitted transactions may confirm just a while later anyway, too


So what's the danger with majority attacks?
An attacker controlling more than half of the mining power could do a few things. For example.


They could declare certain transactions as invalid. By refusing to include them in their blocks and refusing to build on any block that includes them the unwanted transactions would see any confirmations they picked up quickly reversed. Someone trying to make money could use this to set minimum transaction fees. A government trying to regulate bitcoin could allow only addresses registered with the government.
They could collect all the mining rewards by refusing to build on anyone else's blocks, since the total mining rewards are roughly fixed this would get them more bitcoins than just taking their fair share of mining rewards.
They could spend bitcoins to get something non-bitcoin in exchange and then later reverse those transactions leaving the people they exchanged with out of pocket.


If the attackers aim is to make money these things are probably a bad idea. They would likely destroy the value of bitcoin and destroy the attackers profits

OTOH if the attackers goal is to destroy or subvert bitcoin these things may be more worth doing.