When you notice a nail in your tire don't pull it out otherwise you'll let all the air out of your tire and be left with a flat tire.
The best thing to do is to leave the nail in the tire and drive slowly to a tire repair shop to have the nail removed and have the tire patched.
Most times the nail will stay in the tire and stop the air from coming out which allows you to drive the car long enough to reach a tire repair shop.