At your workplace however, you should be leading upwards. Instead of waiting for your boss to tell you what to do, find out what the company wants and needs and find a way to get there. When there's a problem, offer a suggestion. Be the first to tackle a problem, instead of waiting for someone else to.
Like many jobs, it's not certain when a manager post opens. A team might make do with less managers than they need, or hire one manager more than they need at times. Some people get locked into a "team lead" role rather than a management one. If you prove yourself ready for a higher post, they might just create one for you and put you in it.
The usual way into a first management job is to follow a previous manager to a new company where the manager is getting a promotion. The manager needs allies and can't trust people at the new company, so brings along one or two as managers.
Don't believe for a second that hard work or not screwing up will lead to a management position. If you think this you are not ready for a management position. For instance a lead dev I worked with screwed up a critical messaging system badly. He was already slated for a management job, so another dev was moved in to take the blame. This is what goes on in businesses as a matter of rule, not exception.
You need to make some deals and show a propensity for management 'skills' namely bending reality and perceptions towards your point of view while motivating people to do things they don't want to do.
It's very difficult to gain a promotion while also moving to an equivalent-or-better company. The easiest move is to go up in role while trading down in company, or up in company but down in role. True career advancement happens through internal promotion, or happens if you "trade up" to an equivalent role at a better company.