How/when are transactions removed from the not-confirmed pool?
In Bitcoin Core, the memory pool is a consistent set of transactions that can legally follow the best known block. As already mentioned, there is no guarantee of consistency between different nodes' mempools.

In practice that means:


when a new block is accepted (received from the network or locally mined), all transactions in it are removed from the mempool, while their dependencies are kept.
when a new block is accepted, all transactions that conflict with transactions in that block, plus all their dependencies, are removed from the mempool.
when a block is reorganized (disconnected), its transactions are attempted to add back to the mempool in reverse order (since they may interdependent), unless they conflict with transactions already there.