Before starting, close the garage door unless you're working on the lower rollers. To replace a broken roller, you must unbolt the affected hinge, and push it away from the door to remove the roller from the track. You may need a hammer to tap the hinge's bolts out before you can get the hinge out from the door. Be sure to put the nut loosely back on the bolt before you do this, though, so you don't accidentally damage the threads on the bolt.
To replace the rollers, reverse what you did while removing the roller to put the new roller on the track. To re-attach the hinge, put the roller back on the track, position the hinge, and tap the bolts back through from the outside. The bolts are called carriage bolts, and there is no gripping surface to hold onto when tightening the nut. As such, if you don't tap the bolt into place before tightening, it might not fit into the square hole it's supposed to sit in and turn instead of tighten, which might strip the wood. So in order to properly tighten the bolt, after tapping it in, hold the threaded end of the bolt with pliers and tighten the nut with a wrench. Even with these measures, old doors sometimes rot around the bolts allowing them turn.
If the repairs must be made while the door is open, first be sure the tension is out of the garage door cable before working on the bottom rollers. Then, brace the door in its raised position with a ladder or something similar to keep it from sagging or breaking when the
hinge is unbolted.
If you are working with a bottom hinge, disconnect the cable from the bracket or just release the tension from it. Since the weight of the spring exerts a lot of force on its own, disconnecting the cable may be difficult. Should you wish to do so on a difficult cable anyway, first clamp the cable to the track with some slack on the side of the roller bracket. You can then proceed with the replacement as described above.
Be sure to test the door once the repair is made before re-attaching the garage door opener, if you have one, and again afterwards to make sure it runs smoothly.