The handstand is one of the basic fundamental skills from which many other skills stem. The mastering of this skill will lead to development of other skills and reinforce them along the way. However, as easy as it can look, many gymnasts find it a puzzling skill to get right.
The first and foremost problem is insufficient strength. Muscles in the legs are needed to kick the body up to the handstand. Arm muscles are needed to hold the handstand. Stomach and back muscles are needed to keep the body straight.
Secondly, gymnasts learning handstands may have a fear of kicking over too hard. While the prospect of falling over the other way is a scary thought, it is necessary to kick up hard enough to get to vertical. And to learn exactly how hard you need to kick, you need to go over, and from there work by trial and error to see how much force you need to apply.
You can overcome this fear by learning how to safely "bail" out. One way is to do a forward roll out of the handstand. Another is to do a quarter twist and step down. Either of these can be applied when you feel that you are going to fall over backwards.
Once you get a better idea of how much you need to kick, try doing some handstands against the wall. While standing facing a wall, kick up to handstand so that your back and feet are touching the wall. As you become more experienced with this exercise, move your hands closer to the wall so that you become less dependent on the wall and more dependent on the strength of your arms.
Holding handstands for a while at a time will also develop the muscles you need. Begin by holding handstands against the wall for 15 seconds at a time. Every several days add on another chunk of time (i.e. another 5 seconds). Then, with a spotter, do some handstands on the floor. The spotter should hold your legs only tight enough to make corrections if you begin to fall.
Also try doing handstands so that your are in a handstand with your stomach against the wall. Move your hands closer to the wall and hold the handstand there. Push your shoulders out so that they are almost touching your ears, and keep your whole body tight. This will work the muscles in your shoulders and upper back responsible for balancing.
Some common mistakes while learning handstands can become bad habits and make handstands harder to maintain.
To test to see if you are strong enough to hold your body straight, lie on the floor on your back, with your arms down by your side. Tighten your body, keeping it straight along the floor. Then, have someone lift only your feet about 3 feet into the air. If you are still tight, your legs, hips, and torso all should still be as straight as they were when you were still flat on the ground.
Finally, once all these drills have been mastered, practice. Know how your body responds to certain changes, and see what works best for you. Over time, you will learn what a good handstand feels like, and can then try to make it consistent. Good luck!