Gov. Sarah Palin of Alaska abruptly announced on Friday that she was quitting her job at the end of the month, shocking Republicans across the country and leaving both parties uncertain about whether she was leaving national politics or laying the groundwork for a presidential run.