Suicide is the obvious choice - as long as you have the cognitive and physical ability to make it.
Once past that point - for example, in case of stroke or injury, where the damage comes on suddenly - it's up to others. Where possible (and legal), it's a good idea to have contingency plans in place with a trusted friend, relative or care-giver.

The good news is, countries with advanced law-enforcement tend also to have tall buildings, sleeping pills, plastic bags and cars.
Countries that lack those amenities tend to have plenty of firearms, courtesy of the countries that do have amenities.
Or, I suppose you could go out in the woods and piss off a bear or tiger. Farther north, they still have a few unoccupied ice-floes.