Daniel B. answered 05/17/24
A retired computer professional to teach math, physics
First of all, let's handle your question about the 5V.
Let A and B be the two nodes (those big dots) on both sides of the resistor R.
The voltage difference between A and B is simultaneously the voltage difference
across the resistor R as well as the 1000Ω resistor.
(This is a consequence of the assumption of no resistance in the wires,
which implies no voltage drop across wires.)
This is the reason why the voltage across the resistor R is the same as over the 1000Ω resister,
namely the given 5V.
(This could also be derived more formally using Kirchhoff's loop law.)
Once we have the 5V between A and B, this leaves 20V for the 2000Ω resistor.
That means, that the voltage between A and B is four times smaller than the voltage
across the 2000Ω resistor.
That means that the effective resistance, Re, between A and B must be four time smaller,
which is 500Ω.
The effective resistance can be calculated by the formula
1/Re = 1/R + 1/1000
So we have the equations
1/500 = 1/R + 1/1000
Solving this equation gives
R = 1000Ω