New Zealand will learn Friday who is in a position to form its next government, three weeks after an election that was too close to call.