user100257: What prevents miners from mining more bitcoin after 21million btc was mined?

user95422: When a miner find a valid hash he had to write the new block according to  the bitcoin protocol rules, if he try to cheat, like writing that instead of the 12.5 bitcoin that issued to the bitcoin miners (him) it is 50 bitcoin, the network will refuse and ignore this block till he write it properly or someone else write it with the good hash and the right rules.
So in your case the protocol said that there will be no more bitcoin issued after the year 2140 if the protocol does not change, a winning miner have to be careful to follow the rules when he issue his block or he can loose his coins since another will see the winning hash but not the proper block, so he will write the block himself with the winning hash and the proper rules and take the coins for him.

user5406: The Bitcoin protocol allows block authors to create a limited amount of new bitcoins in the outputs of the coinbase-transaction (which also collects the transactions fees) in each block. The amount of the so called block subsidy is limited by the consensus rules.1 Creating more than the allowed amount makes a block invalid to other Bitcoin nodes. 
Each full node unilaterally enforces the consensus rules. This means that while a miner would be able to create a block that breaks the consensus rules, every other full node in the network would recognize it as invalid, drop the block, and ban the peer that sent it to them.
A change in the consensus rules that allows blocks that were previously considered invalid is called a hardfork. Hard forks require social consensus of the complete ecosystem or will cause a split of the network as each node operator determines for themselves which software to run. Even if a majority of the hashrate and a majority of the network's nodes hardforked to a new version of the Bitcoin protocol that allowed blocks with a higher block reward, the remaining nodes enforcing the original consensus rules would consider it invalid and continue to follow their own rules. Therefore, an intolerant minority may be able to veto a hardfork, especially if this minority has a significant share of the economic weight. If the economic majority prefers the original rules, miners following the hardforked chain may find it difficult to sell their mining reward. This is essentially what happened in the case of the SegWit2x hardfork attempt.
In the case that both protocol versions have some economic support, a persistent fork may be calved in the form of an airdropped altcoin. This is essentially what happened in the cases of Bitcoin Cash spinning out from Bitcoin, and Bitcoin Cash calving Bitcoin SV.

1
The block subsidy started at 50 bitcoin per block and halves every 210,000 blocks. We're currently in the third era where miners are allowed to create 12.5 bitcoin per block. Having recently passed block 600,000, more than 18,000,000 bitcoins have been found already, and the next halving to 6.25 bitcoins per block is coming up at block 630,000 in spring 2020.

100257: <p>What prevents miners from mining more bitcoin after 21million btc was mined?</p>
 95422: <p>When a miner find a valid hash he had to write the new block according to  <a href="https://en.bitcoin.it/wiki/Protocol_rules" rel="nofollow noreferrer">the bitcoin protocol rules</a>, if he try to cheat, like writing that instead of the 12.5 bitcoin that issued to the bitcoin miners (him) it is 50 bitcoin, the network will refuse and ignore this block till he write it properly or someone else write it with the good hash and the right rules.</p>

<p>So in your case the protocol said that there will be no more bitcoin issued after <a href="https://bitcoin.stackexchange.com/questions/10486/when-will-the-last-bitcoin-be-mined/">the year 2140</a> if the protocol does not change, a winning miner have to be careful to follow the rules when he issue his block or he can loose his coins since another will see the winning hash but not the proper block, so he will write the block himself with the winning hash and the proper rules and take the coins for him.</p>
 5406: <p>The Bitcoin protocol allows block authors to create a limited amount of new bitcoins in the outputs of the <a href="/questions/tagged/coinbase-transaction" class="post-tag" title="show questions tagged &#39;coinbase-transaction&#39;" rel="tag">coinbase-transaction</a> (which also collects the transactions fees) in each block. The amount of the so called <em>block subsidy</em> is limited by the consensus rules.<sup>1</sup> <strong>Creating more than the allowed amount makes a block invalid to other Bitcoin nodes.</strong> </p>

<p>Each full node unilaterally enforces the consensus rules. This means that while a miner would be able to create a block that breaks the consensus rules, every other full node in the network would recognize it as invalid, drop the block, and ban the peer that sent it to them.</p>

<p>A change in the consensus rules that allows blocks that were previously considered invalid is called a <a href="https://bitcoin.stackexchange.com/q/30817/5406">hardfork</a>. Hard forks require social consensus of the complete ecosystem or will cause a split of the network as each node operator determines for themselves which software to run. Even if a majority of the hashrate and a majority of the network's nodes hardforked to a new version of the Bitcoin protocol that allowed blocks with a higher block reward, the remaining nodes enforcing the original consensus rules would consider it invalid and continue to follow their own rules. Therefore, an intolerant minority may be able to veto a hardfork, especially if this minority has a significant share of the economic weight. If the economic majority prefers the original rules, miners following the hardforked chain may find it difficult to sell their mining reward. This is essentially what happened in the case of the SegWit2x hardfork attempt.</p>

<p>In the case that both protocol versions have some economic support, a persistent fork may be calved in the form of an airdropped altcoin. This is essentially what happened in the cases of Bitcoin Cash spinning out from Bitcoin, and Bitcoin Cash calving Bitcoin SV.</p>

<hr>

<p><sup>1</sup><sub>
The block subsidy started at 50 bitcoin per block and halves every 210,000 blocks. We're currently in the third era where miners are allowed to create 12.5 bitcoin per block. Having recently passed block 600,000, more than 18,000,000 bitcoins have been found already, and the next halving to 6.25 bitcoins per block is coming up at block 630,000 in spring 2020.</sub></p>
