As for pulling out of Iraq, Shortly before Obama took office in January 2009, his predecessor, George W. Bush, finalized an important agreement after about a year of negotiations with Iraqi Prime Minister Nouri al-Maliki. Called the Status of Forces Agreement, it spelled out the withdrawal of all American troops by the end of 2011.
The agreement failed over a demand by the U.S. that American troops be given immunity from prosecution by Iraqis, a very touchy political issue within the Iraqi Parliament. Obama was not going to allow American troops to be judged by Iraqi courts after the disaster that was the Bush Administration's prosecution of the war.
One can easily imagine how "enraged" Republicans would've been had Obama agreed to allow American troops to be prosecuted in Iraqi courts for alleged crimes. They might've started throwing shoes!