Generally, by sealed envelopes, and by having groups of people inspect mail votes at counting time to ensure the envelopes haven't been tampered with. There's also usually a paper trail from the post office that receives the votes so you can't just show up with a couple of thousand "mail votes" and send them in.
It is obviously less secure than voting in person, but it's good enough, and your in-person vote supersedes your mail-in vote.
Here's link to King County (Seattle) elections and how they work. Ballots come in by mail and can be dropped off at county owned lockboxes. This video shows how ballots are secured and counted.
In my piece of Floriduh a non-expert franks the signature on the envelope. It's still more secure than voting in person as state law prohibits inspection of paper ballots in a recount; The only regular ballots recounted are the machine-generated totals.
It is obviously less secure than voting in person, but it's good enough, and your in-person vote supersedes your mail-in vote.