Can a Transaction Be Removed from the Mempool?

Yes, a transaction can be removed. This happens if it is included in a confirmed block, if it is replaced by a higher-fee transaction from the same address (RBF), or if it simply expires after a long period of waiting.

Different nodes may have different expiration policies.

How Does a Transaction’s “Replace-by-Fee” (RBF) Feature Attempt to Reduce Latency?
What Is the Role of “Network Latency” in a Successful RBF Double-Spend Attack?
How Long Does a Transaction Typically Remain in the Mempool If Unconfirmed?
How Do Replace-by-Fee (RBF) Mechanisms Help Users on a Congested Network?
How Does a “First-Seen Safe” RBF Proposal Attempt to Address the 0-Conf Security Issue?
How Does RBF Relate to the Concept of “Transaction Malleability” in Cryptocurrency?
How Does the Concept of “Double-Spending” Differ from RBF?
What Is the Practical Difference between “Opt-in RBF” and “Full RBF”?