Wood stain problems are almost always attributable to improper surface preparation. Undervalued by many amateur do-it-yourselfers, preparation is a critical part of the painting process.
Properly treated wood will accept stain without problem.
Varnish is a protective, glossy topcoat, applied to protect wood from moisture and abrasion damage. It also prevents stain absorption.
When stain is applied directly over varnished wood, the finish goes on blotchy and will eventually peel and flake. You should use a low-grit sandpaper to strip varnish before you apply stain.
Most wood is coated with some amount of sawdust. Sometimes sawdust can interfere with stain absorption, leading to uneven finishes that look blotchy.
You can remove sawdust by wiping the wood with sticky tack cloths.
Treated wood contains chemicals, reverse-vacuumed into the fibers to instill resistance to infestation and rot. Treated wood contains moisture that prevents stain absorption.
You should wait a minimum of six weeks for new treated lumber to dehydrate. If you stain treated wood too soon, the finish will flake.
Water is incompatible with oil-based stain. When stain is applied over moist wooden surfaces, flaking is inevitable.
Humidity can also affect stain absorption. Do not stain wood unless it is completely dry.
If you are staining exterior wood, wait for a warm day when conditions are dry.