How to sew a button?
The trick with sewing on buttons by hand is to make sure you use a spacer! This adds a little space between the two fabrics add the button itself. I do this all the time and they never come off. The little bit of breathing space really helps.

How to Sew on a Button
Step 1: Thread the Needle &amp; Knot the End
How much thread do you have?  If you have 24 inches go ahead and “double over,” which means sliding the thread through the eye of the needle and then doubling it over until you have equal amounts on either side.  You want at least 12 inches to work with.  A doubled-over thread can just have the ends knotted together in a basic square knot, or you can use the same method as a single end.
Step 2: Create Anchor “X” Point
Starting at the back end of the fabric, run the needle through to the front where the button is going to be needed.  Run the thread through to the back, and then again back to the front.  You want to create a small “X” where the button will be centered. This X is also the reinforced anchor for the thread to ensure it doesn’t loosen during stress.
Step 3: Position the Button

Put the button on the anchor “X” and begin sewing by pushing the needle from the back to the front through the first button hole. At this point you want to add the spacer (a second needle or a toothpick, pin, or small stick can be used).
Push the needle up from the underside of the garment and through one of the holes on the button. Pull the thread all the way through until the knot snugs against the underside of the fabric. Use a fingertip to keep the button in its place.

Turn the needle around and push it back down through the hole opposite the one you came up from. Push it all the way through and tug the thread tight. You should be left with a single small line of thread across the button, connecting the two holes.
You’ll repeat this process for six passes, three for each set of holes on the button.

Step 4: Create the Shank
On your last repetition of the previous step, come back up through the fabric but not through the button. Come up like you were going to go through the usual hole in the button, but turn the needle aside and bring it out from underneath the button.

Use the needle to wrap your thread around the threads beneath the button. Make six loops around the bridges of thread that connect the button to the fabric, behind the button itself.
Pull tight and then dive the needle back into the base to be tied off on the other side of the fabric.

Step 5: Tie It Off
Make a small knot on the back side of the fabric. You can use the needle to guide the thread through a knot or you can snip the thread off the needle and tie the knot in the slack with your fingers, but either way you want it snug up against the back of the fabric.
Make a small knot on the back side of the fabric. You can use the needle to guide the thread through a knot or you can snip the thread off the needle and tie the knot in the slack with your fingers, but either way you want it snug up against the back of the fabric.

Probably the easiest knot to tie off is a simple overhand loop tied with the needle still attached. Pin the thread down right against the back of the fabric, under the button, then make a little circle in the thread just beyond your fingertip and pass the needle through the circle. Tighten it down and then cut off the excess fabric. - How to Sew on a Button

When I do buttons, I try to hide the first knot as seen in this YouTube video: An Easy Way To Sew On A Button