Why don't you just invest yourself?
Well first because pensions being large scale investors can get better results and second because most people don't do the smart thing and put some money aside for a rainy day, a pension forces that.
In such a scenario the incoming people function more as a failsafe, the investment should handle paying out for your pension but in cases where there have been a problem in the market, you have outlived your pension expectations etc. you then end up having the failsafe of new people always putting money in. Thus giving the pension an extra layer of security than just investing for yourself.
on edit: of course there can be difference between governmental and company pensions.