Tap the side of the nail with a hammer to loosen it from the mortar, if it extends past the wall. If it is deeper into the wall, you will need to use a chisel.
Chip away the mortar around the nail, using a hammer and chisel.
Grip the revealed nail with a pair of pliers and pull it out. If it doesn’t budge, chip away more mortar until the nail is released.
Replace any mortar you removed, using a re-pointing mortar mix, to restore the wall’s appearance and integrity.