Why is the current before one end of a resistor the same as the current after the other end?
Current is the flow of charge.

If charge goes in one end of the resistor it has to come out the other otherwise the resistor would get charged (and it doesn't).
You can think of current as like a bicycle chain. It goes round in a loop. What leaves the battery on one terminal must return to the other.




simulate this circuit &ndash; Schematic created using CircuitLab
Figure 1. The water circuit analogy.
A simple water circuit analogy might help. In Figure 1b the battery is represented by the pump. The resistor is represented by a restriction in the pipework - in this case a radiator panel.
It should be clear that the water current is flowing in a loop. What goes into the radiator at the top comes out at the bottom and returns to the pump. Similarly in the electrical circuit the current that goes in at the top of the resistor comes out at the bottom and returns to the battery.
So water current is analogous to electrical current. Water pressure is analogous to electrical voltage.
Don't push the water analogy too far!


[From OP's comment:] \$ I = nAeV_d \$ [where n is the number of charge carriers free to move per cubic meter, A is the cross-sectional area, e is the electron charge and \$ V_d \$ is the drift velocity].
So Bart said it's due the drift velocity. n , A and e are constants, so \$V_d \$ is the one which is changing. So The value of the current is directly proportional to \$ V_d \$. Since they are subjected to same electric field \$V_d \$ is constant so &quot;I&quot; must be the same throughout the circuit. So I guess resistance is directly proportional to temperature, and drift velocity is directly proportional to temperature, \$ V_d \$ depends on resistance. Am I right or wrong?

First of all, apologies for thinking you were a beginner and pitching my answer a bit low. It was the PixelPaint edited image in your OP ...
I think you've got this mostly right. \$ V_d \$ will depend on electron mobility which will vary with the conductivity of the material. Watch out for materials with negative temperature coefficients too.