To be able to master the balance and strength to do handstands, you must first do a great deal of training and work. I have found overtime that it is sometimes better to set this up in a handstand workout format in order to target the specific muscles and skills used.
The focus for any handstand workout should be the upper body. A great deal of your strength and balance capability is derived from your core muscles so doing abdominal workouts will always be a benefit to helping out your handstands. At my peak hand balancing skill, this was an example workout that I did.
The first part of my handstand workout always entailed stretching. Flexibility not only helps you to do the perfect handstand, but also helps to prevent injuries. I spent around ten minutes stretching all of my body before I continued to my next step.
The next step of the workout is to just practice walking around on your hands. I would set a goal to either walk across the gym or walk through an obstacle course and around things. I also would practice doing what I call a crab walk-walking to the side instead of forward. The crab walk makes you have to balance in a different direction as one hand goes towards the left while the other follows in a side shuffle across the room. After practicing the crab walk going one direction, I would then switch and do it going into other direction. After about ten minutes of practicing walking, I would move to the wall to do forty handstand pushups. I find it difficult to balance and maintain form after four pushups if I am not using a wall, but if you can do all forty without it, go ahead.
My reasoning for starting the workout with handstands is that by the end of a workout, I am too tired to do handstands very well. The next part of my workout consists of military presses, lat pulls, chest presses, rotary abdominal machines, and bench pressing. I also do some form of back hyper-extension training to make sure that my lower back muscles remain strong. I normally do a pyramid training system where I do one weight at 3×12 reps, a heavier weight at 3×10 and an even heavier weight at 3×8 repetitions, but this can be modified depending on your capabilities. Like always, check with a doctor before you do handstands if you are unsure about any new workout.
Although this is a workout meant to improve your handstands, I would suggest a word advice. Make sure that your other work out days also cover your other major muscle groups. It is never a good idea to only work out one set of muscles because it can lead to muscle strain. On days you do not do handstand workouts, cross train your other muscles in order to get the best results
Note: It is always advisable to check with your doctor before beginning any workout.