What happens with the Pokémon of a trainer after the trainer dies? What happens with the Pokémon of a trainer after the trainer dies? Will they go back to the wild or will they also die?
The Pokémon captured by the trainer belongs to the trainer; when he dies, he has the choice of releasing them or keeping them in their Poké Balls. They will definitely not die with the trainer.

If some other people such as family members releases the Pokémon, it will go back to the wild and become a very strong wild Pokémon. If they don't however, there are many cases such as the Pokémon being passed down to the next generation (if they are qualified). It is similar in our world where if the parents die, some of their belongings goes to the next generation. Someone gives them to a professor somewhere, or the Pokémon just stays in the ball which will have two more cases:


it will eventually break out and escape or stay in the Poké Ball until someone finds it. 
Or as Hakase pointed out, the Pokémon can stay in the Poké Balls for a very long time where no one knows what will happen to it. From the cases shown in the link by Hakase, the Pokémon seem to be fine after a few years without food and water.


My sources of info are the link posted by Hakase and the Pokémon anime.