Once a transaction is on the blockchain, it is confirmed. That is the definition of “confirmed” in the bitcoin system. So a transaction cannot “sit on the blockchain” unless it is already confirmed.
You can broadcast your transaction to the peer nodes that you are connected to, and they can relay that transaction to the peer nodes that they are connected to, and so on until pretty much all nodes on the network have heard about your transaction. The nodes will store your transaction in their memory pool in case any peer requests it. It won’t be “on the blockchain” yet, but some websites might show you the transaction if they have heard about it from any of the nodes they are connected to.
Miners (and mining pools) will have heard about the transaction from their connected peers and they can choose to include the transaction in the block that they are working on if they want to. If a miner chooses to include your transaction in their block and they successfully solve the block before any other miners (or pools) solve a block at the same block-height, THEN your transaction is added to the blockchain. The miner broadcasts his block to all his connected peers, and it is relayed throughout the network until nearly everyone has the block with your transaction in their blockchain. When any node sees this new block with your transaction on their blockchain, that node then considers your transaction to be “confirmed”.
If none of the miners (or pools) choose to include your transaction in any of their blocks, then it won’t get confirmed. Eventually, the nodes on the network will drop your transaction out of their memory pool to make room for newer transactions. There is no specific amount of time that a node is required to remember your transaction. Some might drop it within a few hours, others might wait a day, some nodes might remember your transaction for a week. If someone wants to remember the transaction forever, they are welcome to try to do so.
Once your transaction has been transmitted, it is view-able by anyone on the network. That means that anyone can save a copy of it and re-transmit it later if they want. So if the recipient of your transaction (or anyone else) wants to, they can re-braodcast the transaction every day or so to remind the network and refresh the transaction in the memory of all the nodes.
How often YOU re-braodcast the transaction depends on what wallet you are using. Some wallets (such as Bitcoin Core) will remember all the transactions that they have created, and will re-braodcast the transactions forever trying to remind the network about them so that they eventually get confirmed. Other wallets (such as blockchain.info) will drop the transaction from their storage after a few days if it hasn’t confirmed yet, because they wallet creator assumes that the transaction will never confirm and that most peers have forgotten about it.
Transactions are never “returned to the sender”. They are simply forgotten. If enough of the network has forgotten about your transaction, and your wallet also forgets that you ever sent the transaction, then the wallet will see the bitcoins associated with that transaction as never having been spent and will allow you to create a new transaction that uses those same bitcoins.
If you create a new transaction with the same bitcoins, and if the new transaction gets confirmed, then the old unconfirmed transaction will become invalid (since it tries to spend bitcoins that you don’t have anymore). All nodes will then drop the invalid old transaction from their memory and will refuse to accept it from anyone that tries to broadcast it.
SDgasfdg
From many manuscripts of Antiquity