I suppose some pools accepts the transaction, and sends it backwards. Otherwise it would be stuck forever in limbo.
This is not hiw bitcoin works. A pool cannot "send it back". There is nowhere to send it to, and they don't have the private key.
The pool either confirms it, or they don't confirm it. There is no way for them to "accept it and send it back"
So then please explain how it was sent back? I honestly don't know lol.
To truly understand, you'd first need to understand that there are no actual "bitcoins" anywhere. The concept of "a bitcoin" is just an abstraction that we humans use to make it easier to talk about the transfer of control over value. Your wallet doesn't have any "bitcoins" in it. There are no "bitcoins" stored on your computer. Your wallet is just a set of private keys that are used to create digital signatures authorizing a transfer of control.
To show you how "may bitcoins" you have, your wallet converts each of the private keys that it knows about into bitcoin addresses. Then it scans the entire history of every bitcoin transaction that has ever occurred. This history is called "the blockchain" and every full node has a complete copy of it. After scanning through this history, the wallet can determine how many transactions in that history have outputs that are associated with addresses that the wallet knows about, and which of those transaction outputs have not been spent yet.
Yes, I typed that correctly. You don't spend bitcoins. You spend transaction outputs. Once there is a permanent record in the blockchain of a transaction spending the output of a previous transaction, that output can never be spent again.
So, the wallet adds up all the value attributed to these unspent outputs that are associated with addresses that the wallet knows about, and it displays this total as a number of "bitcoins" to you.
When you "send bitcoins", what you actually do is create a transaction that lists some of the unspent outputs that you control to be "spent", and then creates new unspent outputs and associates each new output with a bitcoin address to be a new unspent output. Then you broadcast this transaction to the bitcoin network and wait for it to be added to the blockchain.
Once it is broadcast, most nodes know about it, so if any of the outputs are associated with addresses that a wallet knows about, the wallet temporarily updates the total that it displays while it waits for the transaction to be added to a block and added to the the blockchain by a miner. At this point it is seen as having 0 confirmations.
If it never gets confirmed, and if none of the wallets re-broadcast it, eventually each of the nodes drop the transaction out of their memory pool. When the transaction is no longer in the memory of a wallet, the wallet will no longer know about it so it will no longer include the adjustment in the value that it displays to you. This means that if you are the "sender", then your wallet will once again include the outputs that you had tried to spend when it displays your value. It also means that if you are the "receiver", then your wallet will no longer know about the new outputs that were supposed to be associated with your address, so it will stop including that new value in the total that it displays to you.
Since the value displayed by the "sender" wallet increases, and the value displayed by the "receiver" wallet decreases by the same amount, it looks like the transaction was "sent back". Actually what happened is that the transaction just vanished and no longer exits.
Notice that there are no miners involved in this process at all.
Now, if a miner chooses to "accept" the transaction into a block that they are attempting to mine, and the miner successfully mines and broadcasts the block, then the block will be added to the blockchain and will become part of the permanent record. In this case, both the "sender" and "receiver" wallets will see the new transaction in the blockchain and will adjust the amount that they display accordingly. As such, it will "appear" that bitcoins have moved from the "sender" wallet to the "receiver" wallet. All that really happened though was that a new transaction was added to the blockchain that "spent" previous outputs and created new outputs.