Miners earn bitcoin from 2 sources when they find a block. One source is the award. This award is halved periodically so each block is worth fewer and fewer bitcoin. Theoretically, these awards will continue to decrease until the awards are extremely tiny and eventually (A REALLY LONG TIME FROM NOW) the last award will be given and there will be about 21 million bitcoins.
The second source is transaction fees. When you make a transaction (for instance when you buy a flight on Virgin Galactic) you have no guarantee that the rest of the world agrees that you made that transaction until someone finds a block which includes your transaction. You increase the likelihood of your transaction being approved by offering a transaction fee. This incentivizes miners to look for blocks which include your transaction.
Eventually, the awards will be very very small but there will be more transactions and thus more transaction fees available to miners. Thus miners must continue for as long as bitcoin transaction are being made.
The chain will never be finished. Mining will (should) go on forever. This hardware will only become obsolete when Bitcoin's proof-of-work is changed from SHA-256(SHA-256(x)) to something else (which might happen in a few years/decades, but until then the hardware will have largely paid itself off).
> This hardware will only become obsolete when Bitcoin's proof-of-work is changed from SHA-256(SHA-256(x)) to something else (which might happen in a few years/decades)
Once they announce whatever comes after SHA-256, would it not be possible to immediately start building ASIC's for whatever that is, and put them to work as soon as the new proof-of-work is used?
Beside that, transaction fees should make mining profitable for ever, in theory. Transaction fees, or transaction volume, only needs to grow by 10x in the next 10 years (from ~0.3 to 3 BTC per block), in order to make them generate more profits to miners than coin issuance.
If the reward gets low enough that people stop mining, then the network adapts to make mining easier, keeping the mining rate constant. It's brilliant.
What are they going to do with all this hardware worldwide when the entire chain is finished in a couple years?