This is done just like with a kickflip. As you fall back toward the ground and land, bend your knees again. This is important! Bending your knees will help absorb the shock of landing on your skateboard, it will keep your knees from getting hurt from the impact, and keep you in control of your skateboard. bend your knees deeply as you land.
Finally, just roll away. If this sounds simple, then great get out there and practice! If this sounds too complicated, dont worry. Just go slow, and take your time.
This is a lot of technical information to remember while trying to do a trick that takes only a second or two. Just make sure you understand the concept - make sure that you have a good mental picture of what's happening. Go practice, and if you run into a wall, come back and read some more, and hopefully you'll get it. Your body is learning how to heelflip more than your mind is, so it may take time. With practice, youll eventually get it.