There are two different reasons. One is that he realizes that his career as a salesman has been a "failure," that he can no longer adequately support his family ... that his life is no longer worth living. This explains some of his early attempts in the car as well as the "tube" in the cellar.
Later on, after his conversation with Ben (who shows him both sides of the proposition), he decides that the best thing he can do for his sons (actually, just Biff, as usual) would be to "die" and provide them with the $20,000 that his life insurance would provide (ironically, it probably provided nothing since most life insurance policies do not pay on suicides ... and they know that Willie had tried to kill himself from actions spoken of earlier in the play when Linda relates her conversation with an insurance inspector).
Once again, Willie loses in the end.