DS18B20 ds(2); // <<<<<<<<<<<<< what is the (2) for?
uint8_t address[] = {40, 250, 31, 218, 4, 0, 0, 52}; // <<<<<<<<<<<<< what are all the 8 single numbers for?
// <<<<<<<<<<<<< where do they come from?
uint8_t selected; // <<<<<<<<<<<<< what means "selected"? which numbers are getting assigned?
//...
selected = ds.select(address); // <<<<<<<<<<<<< what means "selected"? which numbers are returned?
as to these code snippets:
where are the docs about what this code does?