Heaving-to is simply stopping your boat from going forward. You can use it to take a rest, make a coffee or get ready to weather a blow.
All sail plans are different and so are boat hulls. You will have to mess around with yours to see what works for you.
Basically, in moderate winds, up to say 30 kts, you just back your forsail/jib and reef your mainsail. Turn your rudder about 10 to 15 degrees to windward and take it from there.
That is where you start the experiement.
What happend next depends on your boat and sailplan.
You should end up about 50 degrees off the wind and be stopped or at least drifting no more than 1 kt per hour.
Make sure you wont drift into the beach or rocks.
This works most times for me but I am on a full keel type boat.
When I am on a fin keel and spade rudder boat it wont work as well.
Other guys will have different ways but that is it simplified.