In Naruto, when Jiraiya fights Pain, he goes out of the barrier to confirm his suspicion about Pain (that all the 7 pains are dead) but he could have used a shadow clone instead. Shadow clones can transfer knowledge and experience (as told by Kakashi) and if Jiraiya had the chakra to maintain the barrier, swim when he is badly injured and then be alive just to write a message on the back of the toad (apparently I forgot the toad's name), he could have had the chakra to create a shadow clone. Why didn't he do so? [Why did he have die? I feel so sad about him :'( ]
Jiraiya once said: "In the ninja world, it's not how you live. Rather, it's how you die." So I think he applied this quote in his final seconds.
First, we can assume that he hadn't had enough chakra to escape from Pein (don't forget, he was stabbed a lot of times with Pein's chakra absorbing rods), so his last efforts were to send a message to Konoha.
Second, I'm quite sure he knew that this would boost Naruto, so practically Jiraiya sacrificed himself to make Naruto (maybe) the strongest shinobi in the world.
Third, maybe he even knew that his body could be resurrected or used by Nagato as a host body, so he didn't even try to escape. Rather, he realized the seal of his body.
So Kishi had some reasons why to "kill" Jiraiya, but in my opinion, he had to go to make the later story happen.
Another reason to why Jiraiya didn't use Kage Bunshin is because the nature of the jutsu itself. Kage Bunshin no Jutsu splits the chakra of the user equally. This is a risky move for him to perform considering that he is in the enemy territory, no backup and has no idea of the extend of Pain's powers. Suppose that after using Bunshin no Jutsu, Pain found not the Kage Bunshin, but the real him, he would be so screwed having to fight Pain with only half chakra. Having only half of his chakra would prevent him from using some of his jutsus.
It is possible that at that time, Jiraiya has a feeling that the Pain he fought are all dead bodies and that there is someone controlling them remotely. He opted not to use Kage Bunshin for he was afraid that were he to use it, Pain would be able to detect his whereabouts based on the chakra link. Also note that other than the experience the chakra from the Kage Bunshin is also transferred back to the user.