On August 14, 1935, U.S. President Roosevelt signed into law the Social Security Act. Originally implemented to assist older Americans by paying them a continuing income upon their retirement, the program was later amended to extend benefits to the spouse and minor children of retired workers, workers who become disabled, families in which a spouse or parent dies and, more recently, health coverage (Medicare).
The Social Security program is funded through the Federal Insurance Contributions Act (FICA) tax, a dedicated payroll tax. You and your employer each pay 6.2% of your wages, up to the taxable maximum of $128,700. If you are self-employed, you pay the entire 12.4%; however, you can deduct half of the self-employment tax as a business expense. Under the law, Social Security is financed by this designated tax, and any surplus money that isn't paid out in benefits is used to buy U.S. government bonds held in the Social Security Trust Fund.
The money that you pay through taxes is not the same money that you will receive later in life. Instead, Social Security is primarily a pay-as-you-go system, where the money you and your employer contribute now is used to fund payments to people who currently receive benefits, including those who have retired or are disabled, survivors of workers who have died, dependents and other Social Security beneficiaries.
So what's the problem? Basically, demographics.
Americans are having fewer children and living longer, both of which contribute to an aging population. Baby boomers (those born between 1946 and 1964) are retiring at a record pace: 14% of the population is age 65 (the earliest retirement age at which you can collect full benefits) and over, and by 2080, it will be 23%. At the same time, the working-age population is getting smaller, from about 60% today to 54% in 2080.
These trends result in declining worker-to-beneficiary ratios: As we move forward, there will be fewer people putting money into the Social Security system and more people taking money out. Because of these factors, it has been estimated that all the money in the Social Security "bank account" will be exhausted in 2035, when it will have only about 77% of what it should pay out that year. That means that without any changes to the system, if you're in your forties or fifties today, you could conceivably not receive Social Security benefits during retirement, even though you're paying into the system now.
But that's a worst-case scenario. Social Security is nowhere near bankruptcy, and it has nearly two decades to act before funds are completely depleted. Increased taxes, benefit cuts, and upping the age at which people can start collecting benefits (or a combination of these) are all changes that could be implemented to make up any future shortfalls; in fact, the age at which workers are eligible for full benefits has already started creeping up from 65 to 67, depending on one's birth year.
For a more detailed discussion, see How Secure Is Social Security?