Do virtual electron-positron pairs have mass? When a photon produces an electron-positron pair, do both these particles have mass? Why or why not?
 A: 
Do virtual electron-positron pairs have mass?

Virtual particles are within an integral depicted by a Feynman diagram


Only lines entering or leaving the diagram represent observable particles. Here two electrons enter, exchange a photon, and then exit. The time and space axes are usually not indicated. The vertical direction indicates the progress of time upward, but the horizontal spacing does not give the distance between the particles. 

The virtual lines are described by a fourvector, and the "length" of a four vector is the mass for a free particle.In an integral this mass is variable within the limits of integration.
you ask:

When a photon produces an electron-positron pair, do both these particles have mass? Why or why not?

A photon has zero mass, and conservation of energy and momentum do not allow the decay into massive particles. 
A: A virtual pair is by definition "off shell". That is, it does not obey the usual mass relation for that kind of particle:
$$E^2 = m^2 + p^2$$
Rather, it can have any $E$ and $\vec{p}$ such that 4-momentum is conserved at vertices. That means that the meaning of the "mass" of an off-shell system is pretty nebulous. You can, of course, choose to compute a value of $m$ for the virtual pair as though the usual mass relation were accurate. If you do, you will find that it could be anything, including zero.
Computing the mass of a virtual pair serves no useful purpose, nor does contemplating whether it is nonzero.
A: A free photon may not produce electron-positron loops in a correct theory. In the current (incorrect) QED those corrections are mainly subtracted from the solutions - just to remove incorrectness of the original equations.
