Never try to repair a tire yourself. Take your punctured tire to a professional tire installer for a complete inspection to ensure that the tire can be safely repaired. A puncture in the tread area is usually repairable, whereas a penetration in the sidewall is likely not. Your tire installer will be able to make this determination for you.
If the tire is repairable, there are a few different ways to repair a flat tire. The most common repair technique, and the most reliable is a patch and plug combination. For this, the tire must be removed from the wheel. The mechanic will then mark the spot where the tire is punctured and remove the foreign object that caused the flat. Typically a screw, nail or metal shard that became embedded in the tread. The surface of the inside of the tire around the damage is then roughed up using an angle grinder. If the hole is large, a rubber plug may be inserted to fill the hole. Rubber cement is then applied, followed by the patch itself over the plug and cement. The cement actually chemically vulcanizes the rubber of the patch and plug to the tire for an air tight repair. Once the tire is patched it is mounted back on the wheel, and the tire/wheel assembly is balanced.
Again, only a qualified tire technician and installer can decide if a tire is repairable. If the tire was run flat for an extended period of time, the location of the damage is on the sidewall or too close to a previous repair, or the tire tread is close to being worn out, most reputable tire service centers will recommend a new tire over a repair.