Confusion in definition of emf The emf of a cell is defined as the work done per unit positive charge in taking it around the complete circuit of the cell (i.e. in the wire outside the cell and the electrolyte within the cell). But Kirchoff's Second Rule states that the work done in moving a charge around a closed loop is zero. How then do we get a nonzero value of the emf?
 A: 
Electromotive force is the electrical work done to move a unit positive charge from the positive electrode to the negative electrode. It is not about moving the charge through the whole circuit. It is basically the potential difference between the electrodes when no current is flowing.
But according to Kirchoff’s Second Rule, in a loop you reach the same point where you had started from; so the potential difference between the initial and final points is zero, and the net work done in this case is 0. This is different from what we do while understanding the concept of emf!
A: The statement of Kirchhoff's second law closest to what you've quoted is
Around any closed loop the algebraic sum of the potential differences is zero.
$$\sum \Delta V=0$$
This could be re-worded as
The total work done on a 'test charge' going round any closed loop by the electrostatic forces (counting work done against electrostatic forces as negative) is zero.
The key word here is 'electrostatic'. Stationary (or effectively stationary) charges set up conservative electric fields. The net work done on a  test charge by such an electric field is zero around any closed loop.
How does this relate to an electric circuit? Inside the battery chemical processes do work on charges. The work done per unit charge by these processes is the e.m.f.. The result of this work is a redistribution of charge in the circuit. The negative terminal of the battery gains an excess of electrons and the positive terminal a deficit. Thus we now have a potential difference. As charge (positive, let's say) goes from the positive to the negative terminal through the external circuit its potential falls. But when it reaches the negative terminal of the battery and is urged through it by the chemical processes, its potential rises. Overall, as it goes through the complete circuit, there is no change in potential.
Another version of K's second law, and one that is arguably more useful, is
The sum of the emfs in any closed loop in a circuit is equal to the sum of the potential drops.
$$\sum \mathscr E =\sum Δ_\text{drop}$$
Here, 'drops' means drops, not algebraic sums of rises and falls. Thus we are equating the energy per unit charge given to the test charge by non-electrostatic processes like chemical reactions and electromagnetic induction to the falls per unit charge in the acquired electrostatic energy of the charge as it goes round the rest of the circuit.
Notes
• I've talked about charges (or test charges) going round complete loops, to try to give the reader a more lively feel for what's going on. A purist would insist, though, that potential differences exist between points in a circuit independently of whether test charges are actually present to 'experience' them.
• Real batteries and generators are not just pure sources of emf. For example, in a battery the emf is generated at the electrodes, and there is, in fact, a potential drop within the electrolyte as we go through the battery from negative electrode to positive electrode when charge is flowing through the battery in that direction. But this drop is less than the sum of the potential rises due to the emfs at the electrodes. It's usual to say that the potential drop is due to internal resistance, r. So applying K's second law to a battery with a pd V its terminals, we have the high school student's favourite equation
$$V=\mathscr E - Ir.$$
When $I=0$ (that is when there is nothing, in other words an infinite resistance, connected across the battery terminals), then $V=\mathscr E$. So the open-circuit terminal potential difference equals the e.m.f.. Note that I am not presenting this as the definition of e.m.f.. E.m.f. has been defined above in terms of energy.
• Here is one reason for not trying to define e.m.f. in terms potential difference... There are cases when the idea of potential difference can't be used. The classic example is a circular metal ring with a magnet advancing towards it along its axis. There is an emf induced in the ring and a current will flow in it, but by symmetry no point on the ring can be at a higher potential than any other. [Or, putting it in another way, the electric field associated with a changing magnetic field is not conservative.] In such cases we use yet another form of K's second law:
In any closed loop the sum of the emfs is equal to the sum of the $IR$ products.
$$\sum \mathscr E =\sum IR$$
We can, of course, use this in any purely resistive circuit.
A: The emf of the cell is the open circuit voltage at the terminals of the battery (i.e., voltage with no current delivered by the battery). But the cell has internal resistance, $r_b$. So if a wire of theoretically zero resistance were placed across the terminals of the battery the current $I$ that flows results in all the emf dropping across the internal resistance, satisfying Kirchoff's voltage law, i.e.,
$$emf-Ir_{b}=0$$
See diagrams below
Hope this helps.

