If the tire isn’t too badly damaged you may be able to fix it. If it went flat gradually, it’s probably a puncture that can be patched. How you patch a tire depends on whether it’s tube-type or tubeless. Many current bikes have tubeless tires that can be plugged from the outside. A few machines have spoked wheels that require the use of innertubes. A “blowout” on a tube-type tire is usually a tear in the innertube rather than a tire failure, which means you need to replace the tube.
The quickie approach just to get you to help is to squirt some sticky “inflato-goo” such as ThreeBond Seal ‘N’ Air inside the tube or tire through the inflation valve. The goo seals the leak and the propellant gradually inflates the tire to a modest pressure. The inflato-goo should be considered an emergency solution, since it makes any future repairs problematic. However, I have resorted to the puffo stuff after running out of other options. (Test bike, Sunday afternoon, bike shops closed, no plug kit on board, no centerstand, ferry to catch—you know the situation).
Now, if you can actually patch a tire, the general rule of thumb is patch it if the nail is in the center of the tire, replace the tire if you get a nail on the sides.