From where do electrons gain kinetic energy through a circuit?
Supposing an ideal wire ,How do electrons accelerate and gain kinetic energy ?
An ideal wire is an abstraction that is used to simplify calculations in physics and electrical engineering.
The mobile charge in an ideal wire respond instantaneously to external fields so that the skin depth is zero. Clearly, this can't be the case for electrons, and so the charge carrier is 'abstracted away' in this ideal limit and we speak only of the mobile charge within the ideal wire.
In summary, if you're thinking in terms of electrons and their mass, kinetic energy, and potential energy, then it's a conceptual error to to also apply the ideal wire approximation.
If you connected an ideal wire (zero resistance) across an ideal battery (no internal resistance) from Ohm's law the resulting current in the circuit would be
$$I=\frac{emf}{R}$$
Which means for zero wire resistance we would have an infinite amount of current flowing. The thing is, there will always be resistance in an electrical circuit opposing the flow of current just like there will always be some form of friction opposing the motion of masses. Both electrical and mechanical resistance (friction) result in heating.
But we do know that the resistance of wires is generally much less than the resistance of circuit components, so that we may ignore the resistance of the wires (assume them to be zero) that connect the components of the circuit. So it may be more instructive to answer your question in terms of assuming the wires that connect the circuit elements to the voltage source have zero resistance. In this case for a series circuit the current is limited only by the resistance of the circuit components. It is that resistance that prevents the charge from accelerating (thus the constant drift velocity), and where the loss of potential occurs. Since the current is the same in the wires as in the circuit elements in series with the wires, there is no acceleration of the charge in the zero resistance wires. The potential difference between the ends of the wires is zero, so there is no loss in potential.
The applicable definition of voltage here is
"The potential difference V between two points is the work per unit charge required to move the charge between the two points"
MECHANICAL ANALOGY
Consider the following mechanical analogy.
I push a box at constant velocity along the surface of a floor. The constant velocity motion of the box is analogous to the drift velocity of charge (electrical current). I, being the energy source, am analogous to the battery.
The floor surface varies such that for some stretches there is friction and the friction may vary between stretches. Let these stretches of the floor with friction be analogous to the electrical resistance of the electrical circuit components in the path of the circuit.
In between the stretches with friction there are frictionless stretches. Let these frictionless stretches be analogous to our zero resistance connecting wires.
In order for me to push the box with constant velocity on the surfaces with friction, I need to exert a force equal to the opposing kinetic friction force. The greater the kinetic friction (the greater the electrical resistance) the greater the force (strength of electric field) I need to apply and the greater the work I need to do to push the box from the beginning of the stretch to the end of the stretch. The work I do per unit mass of box pushed from a point at the beginning of the stretch to a point at the end of the stretch is analogous to the potential difference (voltage) drop across the resistor. Since there is no change in kinetic energy of the box (no acceleration of the electrons) the work I do in moving the box is dissipated as friction heating at the contact surface. This is analogous to the $I^{2}R$ heat dissipated in the electrical resistance.
I now encounter a stretch of frictionless surface (an ideal wire). No work is required for me to move the box over this surface, so I simply release it an allow it to traverse the frictionless surface at the same velocity it had at the end of the stretch with friction. That no work was needed in this stretch is analogous to there being no electric field in the stretch and no voltage drop.
When the box reaches the next stretch with friction (the next electrical resistor) I (the battery) must once again do work to keep the box (electrons) going at constant velocity (constant current).
So, to sum up, in answer to your question:
From where do electrons gain kinetic energy through a circuit?
They get it from the potential energy supplied by the battery. But they lose it when they collide or interact with the particles that the conductor is made of, such that on average, the velocity is constant (drift velocity). The energy transfer to the particles causes heating. There is always some resistance in the circuit. The parts of the circuit having much less resistance (the wires) do not dissipate the kinetic energy of the electrons, but neither do the electrons gain kinetic energy in the wires because their velocities are limited by the parts of the circuit having resistance.
Hope this helps.