The key indicators that kept coming up were the number of unique words used and the speed at which you speak, so they're involved. I'm hesitant to give the full equation, because I thought it might be better to leave some mystery so we aren't consciously trying to game it while we learn.
It is by no means perfect, but I think it's useful to have some objective metric to track progress.
One followup: does it take into account grammatical errors, incorrect conjugations and that kind of thing?
Sort of. It will try to understand you even if you get the grammar wrong (a bit like a human would), but if it really has no clue what you're trying to say, it will ask you to repeat. I think it's best that way as it mimics learning in real life. If you keep getting your point across, over time, your grammar will slowly improve. The only evidence I have for this is anecdotal from learning Romanian with it myself.