Robots will have rights because we will care about them enough to empathize (regardless of whether or not they can empathize with us). And because at least some of our robots will house algorithms built to adapt to our interests, we will eventually empathize. Because we like things we can empathize with.
When the first man drowns trying to save his robot love, we’ll look on in guilty horror, knowing that there but for the grace of God go I. That plot is already developing. A man recently let a woman drown (link is external) because he claimed he didn’t have anyone to give his phone too.
We’ll never be able to tell if robots have consciousness or not. Consciousness is by definition an introspective experience that we infer about others. One of my old algorithmic cats seemed a little sketchy on the consciousness-scape. But the rest of my cat-gorithms have got the whole self-awareness thing nailed.