One great problem with fire in the wild is that it may not be completely out. What is the recommended procedure to prevent accidental forest fire?
You need to:
Like many questions, this will depend somewhat on your location. For example, some soils will keep coals dry while allowing them enough oxygen to smolder. Some woods produce longer-lasting coals or more insulating ash. Get to know your location. Discuss the question with other fire-makers in your area.
Still, there are probably some general guidelines to follow.
Consider the weather. Rain discourages fires, but certainly doesn't prevent them. Wind makes fires hotter. A long period of dry weather means vegetation and detritus are dryer and more prone to burning.
Prepare the site. Don't make a fire right on a tree root. Roots can smolder underground for a long time. I've been told that there were cases where root systems smoldered for over a mile. Remove forest brush underneath and around the fire site.
Make sure you have a way to put out the fire before you start. Water is the obvious choice. Peeing on fires works, but social protocol and smell may disqualify this approach.
Use small wood. The smaller the sticks, the sooner they'll burn to completion. A smaller, hotter fire with smaller sticks also produces less air pollutants.
Stop adding wood well before you leave camp.
Spread the fuel. A burning stick, isolated, will usually go out, but 2 burning sticks together will usually keep burning. Spread burning sticks and coals and give them time to cool.
Add water. Listen for the tell-tile hissing sound when water hits heat. If I'm using a water bottle with a spout, I can aim a stream well. Stir the water in to the ashes.
Check for heat. Hold your hand close over the ashes & dead coals and feel for heat. If the fire was large, you may need to dig through the ashes to check for buried heat.
About the legal aspect.
It varies wildly depending on where in the world are you and what is the regulation there. There are protected wildlife teritories in which a fireplace shouldn't be made.
Then there are aspects like season. It may not be wise to make fire in certain times of the year in certain areas, like in a dry season.
About the putting out. If a water-source is near, it is best to soak the fireplace itself and the ground surrounding it ( as @berry120 mentioned). It would also be a good idea, if possible, to make a little trench around the fire so that it has less oportunity to spread.
If a watersource is not present - try putting large quantities of dirt on top of the fireplace. The waiting a moment for the flames to go out, then separating the fireplace a little, and throwing more dirt on it. If everything is burried, there should be no open flame possible.
The legalities depend on where you are - the only sure fire way to know is to look it up depending on where you're going.
The best method I find is generally in some ways the simplest - soak it and all the surrounding area in plenty of water, then make sure it's sufficiently cool. If possible, start the fire next to a plentiful water source - such as a stream or a lake, which makes things easier in this regard. It also has the added benefit that if the fire does start to spread you can easily get as much water as you need to put it out, and it can only spread away from the water supply.
After you've applied the water, then be sure to hang around for a good while, don't just leave - especially if it's windy (tempting as it might be to get a move on in such conditions it only takes a bit of wind to blow on a tiny ember to restart the fire.)
If such a water source was not available then (emergencies aside) I wouldn't attempt to start a fire at all, things could just go wrong too easily - and far more often than not it isn't a risk worth taking.