I heard an interview with Youngkin's campaign managers and they made a pretty convincing argument that McAuliffe ran a state wide campaign like it was a national campaign and that McAuliffe had no messaging discipline.
McAuliffe had something like 12 different issue ads, many touching on hot topic national issues at the end and Youngkin had four all dealing with local or state wide issues.
They also made a more complicated but convincing argument that McAuliffe made serious gaffs on education which cost him the race. They thought education would be one of McAuliffe's strongest issues which he gave away.
The lesson should be simple. Know your voters and their issues, have message discipline and a lot of money.