How can a type II error be avoided?
It cannot be avoided, only minimized.
This is an excellent example of understanding statistics as a TOOL, not an absolute! "Type I" and "Type II" errors are complementary - that is, decreasing the probability of one necessarily increases the probability of the other.
ONLY the stakeholders in a study can determine which risk is more acceptable to their decision.
In statistical hypothesis testing, a type I error is the incorrect rejection of a true null hypothesis, while a type II error is incorrectly retaining a false null hypothesis. Which incorrect conclusion would be more damaging to a physical outcome?
We "avoid" (minimize) it in a statistical study by the choice of the Type I error parameter (remember, they are complementary). The rest is just math.
Excellent examples and description: