Let's start with the bike:
The most important thing on your bike, is your brake system, you will need the brake lever on your handle bars. When performing a wheelie, this will help you control speed and prevent you from falling on your butt. Your rear brake has to function properly or you will face the risk of falling.
Adjust your seat to a middle position, You'll ride the wheelie sitting down, and seat position will help keep you maintain your center of gravity and balance.
Now for the wheelie:
Lean back, outstretch your arms and sit on the tip of the seat. this way you'll have a comfortable position while performing the wheelie. Keep one finger on the rear brake lever, and grip firmly on the bars with the rest of your fingers
One of the first things you need to learn, when you come up with the front wheel is how to control the sideway balance - this can be done with your knees, feet or by turning the handlebars in the opposite direction. Just make sure the handlebars are straight before you come down.
If you want to perform a really long wheelie, it is important that you keep your mind clear and look at the horizon. Focus on a small object way ahead of you, that will help you maintain your balance.