Unfortunately, there is not anything that can be done on a technical level to prevent an entity with sufficient mining resources from executing a 51% attack. It is also not possible to be guaranteed to detect the same entity controlling 51% of mining resources because one entity could own multiple pools for example, or could publically identify themselves as two or more entities.
As others have mentioned, economic incentives will largely prevent anyone from executing this kind of attack. It would be possible that a government, or other entity that might profit from the failure of bitcoin may execute a 51% attack, but I would find this unlikely.
It's not only the incentives that keeps the network together, it's also the cost that adds to the risk, which also adds to the Game Theory aspect.
Would you attack the network, and pay for the cost to destroy the thing that enriches you, or simply be honest and cooperate with the network to enrich you?
Some altcoins have been 51% attacked, and were vulnerable because they shared algorithms with other altcoins. This means someone could buy a miner, use it to attack a particular blockchain, and subsequently repurpose their miner to mine on another altcoin's blockchain honestly. An altcoin using the same mining algorithm as other altcoins will reduce its security. The reduction in security for i altcoin will be nominal if the resources going into mining on i's blockchain make up the overwhelming majority of resources being used for that algorithm.
OR rent the hashing power, attack, pay for the rent, enrich themselves.
I see the troll believes someone will take the risk for ONE double spend in Bitcoin. The window to 51% attack Bitcoin has closed.