Sometimes they abandon them underground, but more often they disassemble them and retrieve them for use elsewhere.
For example in the boring of the East-West Green Line of the Kolkata Metro, they retrieved most boring machines and some were redeployed elsewhere in the project.
One was a particularly strange case. Between Esplanade and Sealdah at a place called Bowbazar, an area occupied by many over 100 years old ramshackle buildings, one of the boring machines struck a massive aquifer, which drained into the bored tunnel until they managed to seal it behind the boring machine. But enough water pored into the tunnels to cause subsidence above which brought down about a dozen buildings over a period of time. All the residents were rescued and housed in temporary housing while they started cleaning up the mess underground. Eventually they dug down a shaft from above and retrieved the entire boring machine, and deployed another one from the other end to dig to the shaft. It took two years to rescue the tunnel which was completed recently. Ironically, the original plan was to place the tunnel under a road on the surface, but the local residents for whatever reason rose up in arms and prevented that and forced it to be routed under a residential area, which of course finally all collapsed into the subsidence. People need to think hard about what they are doing before forcing technically unsound courses upon projects as such can come back to bite one in their own rear ends.
You can see the block that was wiped out by subsidence and is now occupied by the rescue shaft which is about to be filled in after the tunnel underneath is completed and the second boring machine coming in from the other end is disassembled and pulled out through the shaft. It is the empty block marked "Metro Work in Progress (Green Line)":
https://www.google.com/maps/place/Bowbazar,+Kolkata,+West+Bengal,+India/@22.568256,88.3617903,173m/data=!3m1!1e3!4m6!3m5!1s0x3a0277abc30987bb:0xea24dd255f2b25b2!8m2!3d22.5668237!4d88.3614764!16s/m/02z9k9x?entry=ttu
Hopefully nothing like this will come to pass in digging the new tunnels in New York. Incidentally while digging the original tunnel;s there were a case of a blowout or two when the roof of the tunnel gave way, but each was sealed and the project rescued. The new tunnel ceilings are much deeper down from the river bed than the original tunnels. That is why the big curve was required to give more liner space to hold the gradients within limits.