The potential warning will depend entirely on the nature of the threat. In the case of escalating political tensions leading to a nuclear exchange there might be days or even weeks of build-up which could also include evacuations of likely targets and other practical preparations by the government.
At the other end of the scale there are conceivable scenarios where there may be no warning at all. For example if a device was smuggled into a city and detonated or if warning systems for incoming missiles failed for whatever reason. It is also possible that a conventional or terrorist-style attack could be used to cause confusion and disrupt normal communications and transportation.
In terms of survival there are several considerations
The direct effect of the blast
Clearly there will be a significant area where your chances of survival are virtually zero whatever you do. In this case you might as well try to get as far away as possible in whatever time you have. As you get further away from ground zero the decision to evacuate or hide becomes more of a balance. Obvious being further way is better but getting involved with hordes of other fleeing people has its own dangers and you may well end up in the open and not much further away.
There is also the risk of buildings collapsing so even if you survive the initial blast you could just end up trapped under rubble with little prospect of rescue. But in reality you will just have to make a snap decision on finding a building which looks reasonably solid.
In urban areas subways are probably not a bad choice. They offer good protection from the immediate effects and even if one entrance is blocked there is a chance of travelling along the tunnels to find a clear exit and alt least you are just trapped and not buried. There is also a good chance that these will be among the first locations tackled by rescue and relief efforts plus they may have at least some emergency power and supplies.
The explosion itself will produce an intense burst of radiation, most notably gamma rays which are both harmful and penetrating and the thermal flash. Here the best protection is to get as much mass between you and the explosion as possible.
A more long-term hazard is fallout which can include a variety of radioactive isotopes in the form of fine particles. These are most dangerous when absorbed by the body with the most immediate risk being breathing them in and later contamination of food and water. There are some medical treatments which can mitigate this at least in part, notably administering iodine to prevent the absorption of radioactive iodine isotopes.
Also basic hygiene measures like avoiding exposure to dust, showering and using respiratory protection will help to some extent, not to mention staying inside.
There will likely be fires and extensive damage to power and water supplies and other infrastructure and in the immediate aftermath there are many of the same problems that you would find in a natural disaster. So clearly a high priority is the basic survival needs of food, water and sanitation.
Here a lot depends on the severity and scale of the attack as to how effectively the authorities will be able to respond. In the case of just a few detonations help may start to arrive withing hours, in the case of an all out attack you could be on your own for some time.
Here the top priority is to reduce your exposure to fallout so if possible change your clothes and wash at the first opportunity, the intention being to remove any radioactive particles stuck to your skin and clothing. Again the biggest radiation risk comes from inhaling or ingesting dust.