A secure button has a sound anchor point, enough thread to move through the buttonhole and a small shank that stops the cloth being strangled against its neighbour.
The coat button failed at a bus stop, naturally, and I repaired it that evening with enough thread to moor a small boat. It looked impressively solid. Two days later the button would not pass through the buttonhole because I had sewn it flat against a double layer of thick wool. My next attempt had no such bulk, but I used old cotton that shredded almost immediately. A button needs security and movement; plenty of thread alone guarantees neither.
Before sewing, look at the other buttons. Their distance from the cloth, thread colour and stitch pattern tell you more than a generic diagram. If one has survived years on the same garment, copy its construction rather than inventing a monument at the empty spot.
Check cloth and position first
A missing button often tears a little fabric where it was attached. If the area is weak, place a small piece of matching cloth behind it or sew a backing button on the inside to spread the strain. Do this before closing any seam or trimming loose fibres that are still holding the area together.
Mark the button's exact position with a pin through the original holes or a light chalk dot. Fasten the garment and check alignment with its buttonhole. On a shirt, one misplaced button can drag the whole front out of line; on a coat, an inch of optimism can make it sit crookedly.
Use a sharp needle appropriate to the fabric and strong, intact thread. Doubling ordinary sewing thread is common for small buttons, but avoid making the tail so long that tangles become the dominant activity.
Start with stitches that can hold
Bring the needle up from the underside, leaving a tail that can be secured beneath the button or incorporated into the first stitches. Take a few small stitches in the fabric before adding the button if the cloth needs an anchor. These stitches should be compact, not a single enormous bite that could pull free.
Place the button on its mark and sew through its holes in the same pattern as the others. For a two-hole button, one pair of lines is enough. A four-hole button may be sewn as two parallel bars or a cross, provided appearance and function suit the garment.
Keep a pin, toothpick or slim match across the top of the button while working, with the needle passing over it. This spacer leaves a little slack between button and cloth. Remove it after the stitches are complete rather than discovering it is permanently woven into the coat.
Wind a shank, not a rope
Lift the button away from the fabric until the stitch group sits just below it. Bring the thread out between button and cloth, then wind it neatly around those threads several times. This forms the shank: a small stem that gives the button room to sit over the layer inside the buttonhole.
The required height depends on fabric thickness. A fine blouse needs little; a heavy winter coat needs more. Test by fastening the garment once the shank is formed but before cutting the thread. It should close without the button pulling rigidly at the cloth.
Too many wraps make a long stalk on which the button flops around. If that happens, unwind a turn rather than covering it with another layer. On shank buttons with a built-in loop, the spacer may be unnecessary because the stem already supplies room.
Finish under the working surface
Pass the needle to the wrong side and make several small securing stitches through the fabric and thread base. A knot can be tucked there, but it should not create a hard lump against the wearer. Run the needle beneath nearby stitches and trim the ends close, without cutting any working stitch.
Check the reverse before declaring victory. A backing button should sit flat, and repairs on lined garments should remain within the cloth layer rather than catching the lining accidentally. Give the button a gentle tug and fasten it again.
My bus-stop coat button is still in place, with a shank just high enough to clear the wool. It took less thread than the disastrous first repair and about fifteen unhurried minutes. The success was in the gap beneath the button, not in sewing it down with all my strength.