The secretary of state’s stop in Beirut represents an effort to push back against Iran’s influence in the region, a major component of U.S. policy in the Middle East.