I think some of them, the last two anyway, were identified through mitochondrial DNA so it had to be through the maternal line. His maternal grandmother was the Tsarina's sister. There's plenty of Romanovs still around and most royal families had various Archduchesses marrying into them in the nineteenth and early twentieth centuries. They could possibly even go down matrilinear lines for the Tsar if needed as his mother and Queen Alexandra were sisters.
Apparently the executioners realised that one of the sisters was still alive when removing the bodies and Alexei survived several bullets, being alive and seated after the first full magazines were emptied . The women's corset were full of gems sewed into them so they acted almost as bulletproof vests, requiring final head shots.
They were all identified by using various samples of DNA provided by several family members across the branches.
DNA sampling is much harder than many assume and DNA is also more fragile.
There were more bodies than just the family of 7, as their very last staff and docs who attended to them were shot with them.
They separated the bodies, so that if someone found them, wouldn't make the connection that it's them.
I am not entirely knowledgable on this, but I think it's still up in the air whether the two who were separate are Alexei and Anastasia or Alexei and Maria. It is mostly assumed it's Maria.
I couldn't read and listen too much about what they did to them, it's entirely horrifying, they didn't all die immediately so they were shot many times, some still alive and were then stabbed with bayonets, some were still alive (!!) when they were carted off to the forest (after all that still breathing and in agony!!!) stabbed and shot again (it would've been better had they not had their jewelled protection, quicker, more humane death), had acid spilled over them and were burnt (to disfigure them so no one would recognize them + being buried apart) and one of them fingered the dead tsarina just so he could say he touched the "imperial c*nt".
I felt sick to my stomach when it was laid out what they did to them after they took them into the basement.
I still can't read too much about it or listen/watch, it's one of the most horrifying accounts of murder (and post-murder mutilation) I've come across (not that I read much on the topic, it's not a particular interest of mine! Too gruesome.).
Nicky & Alix should've sent the kids abroad, but were obsessed with staying together.
I think Anna Anderson claimed to be Anastasia simply because Ana was the youngest girl, less "developed" so could've changed more over the years and fooled people to think Ana just grew up looking different as normal and then of course many others claimed to be "Anastasia" and a real kinda cult grew out of that.