Hillary Clinton won the popular vote by almost 3 million and still lost.
If Kamala wins the popular vote, how much does she have to win by to flip
the electoral college to her side?
Does it matter what states she wins in if the margins are low?
Depends fully on what states she wins
This
It’s all about the handful of swing states, 2/3rds of the electoral votes are basically locked it. She might get a few from out of left field but that has yet to be seen
Take Nebraska, I can tell you right now we will give Kamala 1 electoral vote and the remaining 4 to Tump.
Edit: Anicdotal evidence
This will help you a bit to answer your own question: https://www.270towin.com/ You can play with scenarios there.
how much does she have to win by to flip the electoral college to her side?
This misunderstands how our elections work. If you win a state by one vote (offer not valid in Nebraska and Maine), you get all that state’s electoral votes. If you flip several thousand votes in a few states, Trump wins the 2020 election even though Biden had around 7,000,000 more in the popular vote total. Also, if you’re from the UK, Americans are a little idiosyncratic in their voting. A good deal of people do the equivalent of voting for a Tory even if they wanted Labour in power. It’s called vote splitting, and it’s generally a terrible idea.
If you win a state by one vote (offer not valid in Nebraska and Maine), you get all that state’s electoral votes.
I’m going to pile on to your good answer.
Since you only need 51% to win all of a state’s electoral votes, any additional votes beyond 51% could be considered excess votes that are not helpful. The system rewards candidates whose supporters are spread around, and punishes candidates whose supporters are heavily concentrated in a handful of states.
For example, in 2016 Hilary Clinton got 4,269,978 more votes in California than Trump. That’s 4,269,977 more than she needed to win the state. Meanwhile, she lost Michigan by 10,704 votes, lost Pennsylvania by 44,292 votes, lost Florida by 112,912, etc. Hell, she lost Texas by less than a million votes. If Hilary’s supporters in California had been spread around in other states she would have won the national election easily.