They simply dump it. If two weeks have passed (as a default value) and the transaction hasn't got into a block yet, they'll dump it to free space. I suspect that the transaction is removed from the overwhelming majority of nodes, but most importantly, from most mining pool's mempool.
I think that depends from node to node, like on Bitcoin Core, it is actually 14 days as you commented. Also this can get frustrating, normally the central server or node will keep on rebroadcasting it especially if the person's wallet is sychronize with the blockchain, that is why it is better for such person to never let his wallet not to sychronize during the time for it not to rebroadcast over and over again.
I remembered I had a transaction unconfirmed for two months from February 2021 to beginning of April 2021 when the mempool was so congested.
Also it is good to use a wallet that supports replace-by-fee so if the transaction is not included into a block faster and getting longer, the person would be able to pump the fee so for it to get confirmed earlier than using previous fee.