How does a Monero Node know how to drop transactions from the memory pool?
Besides of course when a transaction gets into a block..
Usually, a timeout, if the transaction could not find its way in a block within a day (the timeout is seven days if the transaction was added in a block which was reorganized away). Why the transaction can't get in a block is another matter, but typically this can be due to a double spend, fee too low, or violating the minimum mixin rules, among others.
Another possibility is if the transaction was manually flushed (ie, either remove the poolstate.bin file and restart the daemon, or use the flush_txpool command in the daemon). In those two cases, the transaction is likely to be received again from peers as they rebroadcast.