Palantir, the software company founded by the billionaire Peter Thiel, won a major contract in Britain on Tuesday to help overhaul the technology system of the country’s state-run health service, overcoming concerns that a firm known for its military-related work in the United States would secure such a sensitive role involving patient data.