How do you get an hard erection?

First, this depends on your age and your health. Young men tend to get hard erections naturally, sometimes unexpectedly (such after having a dream), sometimes when they wake up in the morning, sometimes when masturbating, and sometimes because they saw someone they think is sexually attractive.  As men get older, they may have more difficulty getting a hard erection, but this really varies.  Some older men may need to take a pill for "erectile dysfunction" (you have seen the commercials for Viagra and Cialis) to help them get aroused, but this is not true for everyone.  Also, some medicines have a side effect of making it more difficult to get an erection, but this is often temporary.  

So, if you are young, you will undoubtedly get an erection from masturbating or from watching sexually explicit movies, or just naturally when you see someone you are attracted to. And if you are older, as long as you are in good health, you should still be able to become aroused.  If you are having problems, by all means see your doctor and discuss it, because this condition is very treatable.