After years of divisive street protests and the election of a mainly left-wing body to rewrite the constitution, Chileans surprised analysts, markets and even themselves on Sunday night by favoring a right-wing presidential candidate and delivering significant gains to conservatives in Congress.