Back to pain/nagato when Jiraiya first entered the rain village to look for pain he was told by a rain ninja that Pain had singlehandedly defeated Hanzo and the rest of the hidden rain, We also learn that pain Not only killed Hanzo but all his relatives and their children, Hanzos friends and their children, and all of his clients.
Basically Pain killed anybody who had contact with Hanzo, He didnt go after Danzo though, Nagato probabally hated Hanzo because its his fault yahiko died. But danzo helped Hanzo in that whole opperation and Nagato knew that. Why didnt he try to kill Danzo, With Pains power he proabablly thought that he could go in the leaf and take danzo out with relative ease which at the time he prolly could have
What made it so Danzo escaped or why didnt nagato try to kill him?