For purpose of discussion, assume that due to bad luck, this asteroid has evaded the detection of all amateur and professional astronomers until about six months from impact. The asteroid is too large to deflect with humanity's current spacefaring capabilities, and the general scientific consensus is that the impact will end all multicellular life on Earth.
What do those six months look like?
Everybody would fuck around except China who builds an ultra nuke and fragments or pushes it enough to make it not destroy all life
They would hire a fuck ton of scientists all over the world while most everybody else does jack shit, and others not really having the industrial capacity and organization to actually focus on fixing this issue. A handful of countries would assist China.
But if its a small planetoid we'd be so fucked. It could do so many things like even making the moon collapse into earth, making the entire surface molten, cause the moon to go rogue and disrupt the orbits of other planets, etc. I think China would try to send a ton of people into mars or something or build some sort of asteroid capture colony with all their efforts in that case, sending up enough people to keep humanity moving. Those are possible with proper planning. West would send a bunch of rich useless old people into space and they'd all die. Vast majority of people die but most people actually do work for a common goal in keeping humanity going and there is some sort of digital project that catalogues everyone's ideas and thoughts and all of our knowledge to send into space before death. With proper centralization and urgency a lot of people can become extremely focused and productive. A lot of governments might see spontaneous, nearly unanimous revolutions if they are deemed useless for continuing humanity's future. There would be a great deal of monitoring and data being sent into space to describe the impact and its effects on earth as it happens, some observation posts would go on for some time in bunkers until they too die.
Who gets sent into space is going to be largely eugenicist out of necessity. However, a lot of genetic material would be collected from the people left behind and launched into space in order to ensure more genetic diversity going forward. There would be massive psychological problems, survivorship trauma, trauma relating to losing your whole family, for most people that survive. So people that are less likely to be affected by this might be selected for the program. Most of the people would likely be fairly young yet have the most experience for their age group in hard sciences. A handful of older people with significant scientific experience and good health might also be selected. Most people sent into space would likely be women. The proportion of how many people are women would be highly dependent on how many people are actually sent into space. If there aren't many people being sent into space, its very likely we'd send only women and a ton of sperm from all around the globe for genetic diversity purposes. Women would also only be allowed to birth other AFABs until the population is high enough.