I think pensions can be an efficient form of payment that benefits taxpayers and is fair to employees.
In practice, America has moved to a dual track employment system where private workers use defined contribution plans (or nothing) in addition to Social Security, while public sector workers usually get enrolled in a defined benefit plan. This is actually appropriate because defined contribution can advantageous for a highly stable employer. Corporations aren't committed to the long term sufficiently to profit by offering defined benefit pensions, so they have largely shifted to defined contribution. But public sector employers are mostly stable and can save taxpayer money by maintaining defined contribution plans.
Governments are very complex entities whose tasks are largely similar year to year. Consequently they have more to gain by retaining employees. Defined benefit plans increase employee retention per taxpayer dollar spent. Properly run, they don't cost extra to the taxpayer, they bring more value per tax dollar.
Remember, lots of people work for the government but do not stay long enough to qualify for the pension. Not all employees get the "windfall" of a pension payout, some get bupkus despite serving the public quite well (think of the teachers Lagom described). All public employees contribute anywhere from 6% to 9% of pay, with matching from the public of typically 6% or so. The effect is that total expense overall is closer to the private sector's pay scale than people think.
Take the example of Texas state employees. Texas produces an annual study of compensation and benefits, plus an analysis of employee turnover; pay rates for each job track are adjusted in response to turnover targets as part of an overall plan to keep pay and benefits at a level that benefits the taxpayer. Periodically the legislature changes the details of the pension agreement (similar to TRS as described by a previous poster). The effect? Texas state govt employees work for 5% lower pay than private sector employees of equal education/experience, in return for a 6% state expense toward the pension plan, which is majority funded by the employees themselves. Roughly speaking a wash, but the compensation type is well tailored to the task at hand, arguably providing good value.
Look behind the surface. Public sector pensions can be and often are an efficient compensation form that can save taxpayers money.
Here are reports summarizing the actual data in Texas' case:
http://www.sao.texas.gov/reports/main/16-703.pdf(explains on page 2 that private sector employees get 30.3% of their pay as benefits, while Texas state employees get 36.3%, including the value of their pensions. So the total cost of providing these benefits is only 6.0% more than private sector.)
http://www.hr.sao.texas.gov/Reports/Category/CompensationAndClassification/(analyzes state's pay scale in comparison to private sector for various job groups. The first report concluded in part that base pay was 5% less than the private sector, though that finding was buried in footnotes. Whether the skill of these stable employees is worth the remaining 1% can be debated, but I think the state gets good value. In any case, the net difference is about 1%.)
http://www.hr.sao.texas.gov/Reports/Category/Turnover/ (analyzes pay and turnover rates for various jobs)
If you've never heard of the above studies, realize that behind the headlines, lots of logical and reasonable gets done all the time. Many of our systems are working well. They just don't get headlines because "taxpayers got a fair deal today just like yesterday" doesn't sell advertising.