Let's work first with your particular numbers. Suppose that an item is originally priced at 100 (dollars). Imagine that you inrease the price by $x$ percent. Then the new price is $100+x$.
You want to make sure that if you apply a 20 percent discount to this new price $100+x$, you end up with a price of exactly $100$ dollars.
A $20$ percent discount on a price of $100+x$ means that the price will be $80$ percent of $100+x$.
So the new price is
$$(100+x)\frac{80}{100}, \qquad\text{or equivalently,} \qquad \frac{(100+x)(80)}{100}$$
It so happens that you want this new price to be $100$ dollars.
This gives you the equation
$$\frac{(100+x)(80)}{100}=100.$$
You would like to "extract" $x$ from this equation.
First multiply both sides by $100$.
On the left, you get simply $(100+x)(80)$. On the right, you get $(100)(100)$, which is $10000$.
So our new equation is
$$(100+x)(80)=10000.$$
So something, namely $100+x$, multiplied by $80$, is $10000$. What is the something?
The idea is to divide both sides by $80$. On the left, you get $100+x$. On the right, you get $10000/80$. By calculator or by hand division, you get that $10000/80=125$.
So our new equation is
$$100+x=125.$$
Now subtract $100$ from both sides. We get
$$x=25.$$
This tells you that you must apply a $25$ percent markup so that a $20$ percent discount will leave the price unchanged.
This may look long, but that is only because I have done the calculations in great detail.
Note Since we are dealing with percentages, the answer is independent of the actual initial price, which for simplicity we took to be $100$.
Let's use the same reasoning to solve a different and harder problem. You want the final discount to be say $17$ percent. Let us ask what percent markup there should be so that at the end, after the discount, you end up selling the originally $100$ dollar item for $105$ dollars. The process will be almost exactly the same, except that the numbers will be a lot uglier, so you will have to use a calculator.
Let the desired markup be $x$ percent. Then the price is $100+x$. You want to apply a $17$ percent discount to that. So the new price would be $83$ percent of $100+x$. You want this new price to be $105$. So $83$ percent of $100+x$ is $105$.
That gives you the equation
$$\frac{(100+x)(83)}{100}=105.$$
You want to extract $x$ from this equation. The procedure is in outline much the same as before. First multiply both sides by $100$.
So our new equation is
$$(100+x)(83)=10500.$$
Now divide both sides by $83$. We will not get a simple integer on the right, so I will round off, and sloppily still write "$=$" when I mean almost equal. If you are following this with a calculator, you should get something like
$$100+x=126.506.$$
Now, like before, subtract $100$ from both sides. We get
$$x=26.506.$$
Of course this is absurd precision. For all practical purposes, the markup should be $26.5$ percent.
I hope there is enough detail in the above calculations to enable you to solve problems of the same general kind with not much difficulty.