Solution:
The main idea for getting the solution for this puzzle is that the pirate should know that he will be getting the treasure for the acceptance of the proposal. And if he gets to know that the treasure he is getting is less than the others then he will not accept the proposal. If the last one who is left is the pirate 1 then he will be the one who will be getting all the golden coins.
If pirate 1 would be the only one left, he would get all the golden coins. If only pirates 1 and 2 would be left, pirate 2 would die for sure, since pirate 1 is bloodthirsty and will reject all proposals of pirate 2 (since he will get all coins anyway). So:
| Pirate 1 | Pirate 2
----------------+------------+------------
Number of coins | 1000 | 0
----------------+------------+------------
Pirate agrees | No | Yes
When also pirate 3 would still be alive, he needs the agreement of one of the other two. Pirate 2 will agree with every proposal since, as we have seen, he would die if he did not. Therefore, pirate 3 should propose to keep everything for himself.
| Pirate 1 | Pirate 2 | Pirate 3
----------------+------------+------------+------------
Number of coins | 0 | 0 | 1000
----------------+------------+------------+------------
Pirate agrees | No | Yes | Yes
When we have four pirates, pirate 4 should make two other pirates agree with his proposal. Therefore, he proposes to give one coin to pirate 1, one coin to pirate 2, and the rest to himself. Pirates 1 and 2 will accept the proposal, since they are greedy, and if they would not accept, they would get less.
| Pirate 1 | Pirate 2 | Pirate 3 | Pirate 4
----------------+------------+------------+------------+------------
Number of coins | 1 | 1 | 0 | 998
----------------+------------+------------+------------+------------
Pirate agrees | Yes | Yes | No | Yes
However, as we know, there are five pirates. If pirate 5 gives both pirate 1 (or 2) and pirate 3 one coin more than in the previous case, they are willing to accept the proposal. Then a majority (three out of five) of the pirates will support the proposal, and pirate 5 can keep the rest of the treasure to himself.
| Pirate 1 | Pirate 2 | Pirate 3 | Pirate 4 | Pirate 5
----------------+------------+------------+------------+------------+------------
Number of coins | 2 | 0 | 1 | 0 | 997
----------------+------------+------------+------------+------------+------------
Pirate agrees | Yes | No | Yes | No | Yes
Conclusion: Pirate 5 should propose to give two coins to pirate 1 (or 2), one coin to pirate 3, and the remaining 997 coins to himself.