system
Given the following post, respond as if you're commenting on Reddit:
human
[Pokémon] What happens to the Pokémon of a trainer that dies?

Since the Pokémon form a co-operative bond with trainers upon being caught, and it is clear from testimony at Lavender Town and Mount Pyre that humans clearly mourn their Pokémon that pass on, what happens if the trainer is the one that dies first? To cover some bases, I will provide scenarios.

1. The Trainer dies of natural causes at an old age.

2. The Trainer perishes from a terrible disease, surrounded by their partners as they pass on.

3. The trainer is killed by wild Pokémon.

4. The trainer is murdered by another human.

5. The trainer dies in an accident (hit by a train, falling off a cliff, etc.) 

These scenarios assume the Pokémon are not in their pokéballs or in a PC, and witness their Trainer's end. What would happen?
gpt
>1. The Trainer dies of natural causes at an old age.

Likely mourns the trainer's loss, but having had time to acclimate to the trainer's advanced age, is ready to move on far sooner. Assuming the Pokemon isn't also about to die of old age, they remain either in the local area of where the trainer lived their final years, or they get adopted by friends or family of the deceased. 

>2. The Trainer perishes from a terrible disease, surrounded by their partners as they pass on.

Given by the hospital or Officer Jenny (depending on whether they died in hospital or were found at home) to the local Pokémon professor for care and study until they get adopted by an up and coming trainer or a friendly family (depending on the Pokémon and its nature). 

>3. The trainer is killed by wild Pokémon.

Depends on the Pokémon's nature. Mourns the trainer's death, and either tries to flee for its own life or tries to kill the other Pokemon out of revenge (successfully or dies in the process). If it survives, wanders the world wracked with guilt for years. If it ever trusts itself with a trainer again, becomes very protective (maybe even forcing itself to evolve) to protect their new trainer from the same fate. 

>4. The trainer is murdered by another human.

Same as the above scenario, with a much higher rate of success for killing the threat. However likely has much less trust in humans, probably takes a truly kind person to gain its trust and help it recover from the trauma. Likely to start off very violent towards humans. 

>5. The trainer dies in an accident (hit by a train, falling off a cliff, etc.) 

Same as scenario 2 for the most part, but feeling much greater blame on themselves for not helping prevent the accident. 

>These scenarios assume the Pokémon are not in their pokéballs or in a PC, and witness their Trainer's end. What would happen?

So in most scenarios the Pokémon will either go immediately into foster care with the local Pokémon professor, Pokémon Daycare, adoptive family, or relatives/friends of the deceased. Might be an interim time where the Pokémon is by itself in the wilderness due to not being found by humans yet, or due to personal blame and self-imposed isolation. But typically the Pokémon will get readopted at some point.