Transporters work by de-assembling something (e.g. you) and re-assembling it somewhere else. What if, when you’re dis-assembled, you die, and the re-assembled version of you is essentially a copy? Then every time someone steps onto a transporter, their final thought before death is that they’ll end up beamed somewhere else. And the re-assembled version (copy) just thinks that everything went fine and continues on like nothing bad happened.
REALLY depends on the episode/writer.
Some episodes are written like that (Will Riker/Thomas Riker)
Some episodes you keep your consciousness throughout the “beaming” process, so you’re technically you the whole way through (Broccoli in Realm of Fear)
It’s fiction and some writers treated it as a suicide machine, and some wrote it as a movement machine. Even the technical details shifted from episode to episode.