We won't know for sure, but I think it's everyone's predispositions before the debut. I vaguely remember some gg members saying that some of them had more dance lessons because they were better at it, and some had more vocal lessons, apart from the general training. (I can't remember who said that though)
The interesting thing is that sometimes idols improve with time or develop the skills they haven't had before years after debut, and in this situations the original positions are no longer valid. I don't think any company has ever changed the positions, but I may be wrong. A good example is Jihyo, who was already mentioned. Her dancing improved so much over the years, that some people think that now she's also one of the centers in a group, put more in the spotlight.
There are also cases when some members are skilled in both singing in dancing, then I would guess the company chooses one thing, maybe depending on which other positions are already given? Someone that comes to my mind here is Luna from f(x). She got into SM thnks to her dancing skills but ultimately debuted as the main vocalist. I believe her dance skills were on par with their main dancer, Victoria (although each of them shone in different dance styles), yet her vocal skills got so developed, she ended up being their best vocalist.
There have been some position changes in NCT. Taeyong and Yuta used to be 127's main dancers, it became Taeyong and Mark. Renjun was lead vocalist at the start, he became main vocalist. More people have gotten lead dancer positions I think. Obviously when Mark graduated Jeno took his place as main rapper and Jaemin to Lead Rapper when Mark rejoined Jeno got demoted to Lead Rapper but Jaemin still improved upon his debut.
Jihyo got much better and Mina's general dance skills outside of idol choreos are still of a higher level then most members of Twice but during the 170728 VLIVE Chaeyeong and Jeongyeon reveal that Tzuyu, Mina and Dahyun ended up debuting without passing JYP's initial dance test. If it was about skills at time of debut there would still be different main and lead dancers for Twice.