Brazil is heading to a second-round presidential vote between Luiz Inácio Lula da Silva and Jair Bolsonaro, in a contest described as tense.