First the basic rocket jump. I also recommend using the gun boats while you try this.
Soldier
Technique To do a basic rocket jump crouch, aim the rocket at your feet then fire and jump at the same time. When you aim at your feet try aiming behind you so that the blast will push you forward. If you shoot directly under you, you will go straight up. If you shoot in front of you, you'll be shot backwards.
Uses The rocket jump has tons of uses, getting a view of the battlefield. A way to reach enemies quickly, once you master rocket jumping your maneuverability can best scouts! Also not everyone looks up so you can surprise a lot of people. Finally it can also be a great way to escape if you don't think you will when a fight. Be warned that it makes you a prime sniper target.
Demoman
I suggest using the sticky jumper while you practice.
Technique The uses are fairly similar to those of a soldier, but the technique is slightly different because you will be using stickies instead of rockets. Simply put the sticky on the ground, run over it and the second you pass it 1. Crouch 2. detonate the stick 3. and jump.
Finally once you have mastered the basics you can try to rocket jump by hugging a wall so that you never touch the ground. You can also search for rocket jumper training maps/servers.