To put a guardianship in place, you will start by filing guardianship papers in court. A court investigator will likely interview you, the child, and the child's parents if they are alive and available. The investigator will then make a recommendation to the judge. The judge will review the case and decide whether to appoint you, usually after a hearing. The court must find that the appointment is in the best interests of the child.
If you want to name a guardian for your own children in case you aren't around to take care of them, use a will to name the person you want to take care of them. (If this is what you want to do, read Nolo's article Guardianship for Your Children.)