The State Pension is a regular payment from the government once you reach State Pension age, based on your National Insurance record rather than your income or savings. Since April 2016, most people reaching State Pension age fall under the "New State Pension" system.
How your payment is built up
Your State Pension amount is based on the number of "qualifying years" of National Insurance contributions or credits on your record. You generally need a minimum number of qualifying years to get any New State Pension at all, and a higher number of years for the full amount — the exact figures and current rates are published on gov.uk and are worth checking directly rather than relying on general figures, since thresholds can be adjusted.
National Insurance credits
You don't need to be working to build up qualifying years — credits are available in certain circumstances, such as claiming Child Benefit for a child under 12, receiving certain other benefits, or being a carer. It's worth checking whether you're missing credits you were actually entitled to, since these can sometimes be backdated.
Checking your State Pension forecast
You can get a personalised State Pension forecast through the gov.uk website (or by post), showing your current qualifying years, an estimate of what you're on track to receive, and your State Pension age. This is the most reliable way to understand your own position rather than relying on general rules of thumb.
Filling gaps with voluntary contributions
If your forecast shows gaps, it's sometimes possible to pay voluntary National Insurance contributions to fill them and increase your eventual pension — but whether this is worthwhile depends on your individual circumstances and how many years you have left before State Pension age, so it's worth checking the current rules (and, for significant decisions, considering independent guidance) before paying anything.