How do caregivers obtain legal rights?

Paperwork. Caregivers sometimes have various legal rights depending on what is needed and the wishes of the person for whom they are caring. Among these are healthcare proxy, which allows the caregiver to make decisions related to the person's medical care if they are unable to do so. Papers must be drawn up, signed, witnessed, attested-to, etc for these legal rights to be granted.
Depends on situation. The individual states determine the rights status, here under the texas family code. Parents are given that right at birth, subject to state intervention if they abuse that right. For older adults, they can give power of attorney/health determination, etc. To another willfully or be declared incompetent by a county judge who can assign rights to a third party. It all requires paperwork & time.