How does the mempool work? What happens to the mempool when there are two equal length chains on the network? Is there just one mempool or does each node keep a copy of the mempool?

From my understanding each node needs to keep a copy of the mempool.

If that is true then how is mempool consensus reached? Does it need to be reached?

What happens to mempool transactions when there are two equally long chains on the network?

If I have BTC in my account and send it to someone, but during that time there are two equally long chains on the network, what happens?

Is there a chance that the BTC gets forever lost in a mempool when one of the chains is rejected?
Is there just one mempool or does each node keep a copy of the mempool?


Neither. Every node has their own mempool of transaction they expect to see confirmed. It's not a copy as there is no consistency between nodes.


  From my understanding each node needs to keep a copy of the mempool.


No, mempools are completely optional. You can configure your node to not keep one at all. The only downside is that you won't know about transactions until they confirm.


  If that is true then how is mempool consensus reached?


There is no mempool consensus. If there was, we wouldn't need a blockchain.


  What happens to mempool transactions when there are two equally long chains on the network?


Nodes have just one active chain which they treat as correct. There may be competing chains, but nodes will typically assume that the version they see first will win. If they keep a mempool, they try to keep it consistent with the blockchain as they accept it, not with any possible alternate versions of history.


  Is there a chance that the BTC gets forever lost in a mempool when one of the chains is rejected?


Miners have complete power (together) in determining which transactions are accepted into the chain. It's certainly possible that you issue a transactions which never gets included, but that has nothing to do with chains being rejected.