the Psalms were composed with ruach hakodesh/prophecy which means he was a sort of spokesman for the word of God as David himself said: > The Spirit of the LORD spoke through me; His word was on my tongue. > (Shmuel II 23:2) some of the psalms were even intended for our times as can be seen [here][1]. Also, David was the King of Israel which means he was the heart of the nation and being the first and foremost king this extended to all generations. Hence, the Psalms are for every jew for all times. Hence, even when he seems to be speaking only about himself, it applies for all jews at all times (read this somewhere). [1]: http://dafyomireview.com/269