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?
I would assume the pokemon a trainer has in their pokeballs would still be in there like normal. There's nothing about the trainer and the pokeballs that keeps them in there, so my guess is it'd be just like if you died and had pets. Family members, friends, looters, etc. would take your pokemon and re-purpose them, i.e. use them, donate them, release them into the wild, etc.
If the pokemon were a free-roaming one, like Ash's Pikachu, then it may just get sad and mope around, find a new trainer, find family, etc.
They've actually demonstrated this few times on the show. Kind of how Ash got Charmander. Granted, his Charmander was abandonded, but you get the idea. http://bulbapedia.bulbagarden.net/wiki/EP011
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.
In one ep a Ninetales stayed at her Master home for about 100 years waiting for his return. So i would guess depending on the bond a pokemon have they would stay near where their trainer died or a place their trainer lived. In a Black and White ep a couple of pokemon defended a place where their pirate trainer died. They stayed in a ship for a possible hundreds of years gaurding his treasure of evolution stones.