Is String Theory formulated in flat or curved spacetime?

String theory may be considered as a framework to calculate scattering amplitudes (or other physically meaningful, gauge-invariant quantities) around a flat background; or any curved background (possibly equipped with nonzero values of other fields) that solves the equations of motion. The curvature of spacetime is physically equivalent to a coherent state (condensate) of closed strings whose internal degrees of freedom are found in the graviton eigenstates and whose zero modes and polarizations describe the detailed profile $g_{\mu\nu}(X^\alpha)$.

Einstein's equations arise as equations for the vanishing of the beta-functions – derivatives of the (continuously infinitely many) world sheet coupling constants $g_{\mu\nu}(X^\alpha)$ with respect to the world sheet renormalization scale – which is needed for the scaling conformal symmetry of the world sheet (including the quantum corrections), a part of the gauge symmetry constraints of the world sheet theory. Equivalently, one may realize that the closed strings are quanta of a field and calculate their interactions in an effective action from their scattering amplitudes at any fixed background. The answer is, once again, that the low-energy action is the action of general relativity; and the diffeomorphism symmetry is actually exact. It is not a surprise that the two methods produce the same answer; it is guaranteed by the state-operator correspondence, a mathematical fact about conformal field theories (such as the theory on the string world sheet).

The relationship between the spacetime curvature and the graviton mode of the closed string is that the former is the condensate of the latter. They're the same thing. They're provably the same thing. Adding closed string excitations to a background is the only way to change the geometry (and curvature) of this background. (This is true for all of other physical properties; everything is made out of strings in string theory.) On the contrary, when we add closed strings in the graviton mode to a state of the spacetime, their effect on other gravitons and all other particles is physically indistinguishable from a modification of the background geometry. Adjustment of the number and state of closed strings in the graviton mode is the right and only way to change the background geometry. See also

http://motls.blogspot.cz/2007/05/why-are-there-gravitons-in-string.html?m=1

Let me be a more mathematical here. The world sheet theory in a general background is given by the action $$ S = \int d^2\sigma\,g_{\mu\nu}(X^\alpha(\sigma)) \partial_\alpha X^\mu(\sigma)\partial^\alpha X^\nu(\sigma) $$ It is a modified Klein-Gordon action for 10 (superstring) or 26 (bosonic string theory) scalar fields in 1+1 dimensions. The functions $g_{\mu\nu}(X^\alpha)$ define the detailed theory; they play the role of the coupling constants. The world sheet metric may always be (locally) put to the flat form, by a combination of the 2D diffeomorphisms and Weyl scalings.

Now, the scattering amplitudes in (perturbative) string theory are calculated as $$ A = \int {\mathcal D} h_{\alpha\beta}\cdots \exp(-S)\prod_{i=1}^n \int d^2\sigma V_i $$ We integrate over all metrics on the world sheet, add the usual $\exp(-S)$ dependence on the world sheet action (Euclideanized, to make it mathematically convenient by a continuation), and insert $n$ "vertex operators" $V_i$, integrated over the world sheet, corresponding to the external states.

The key thing for your question is that the vertex operator for a graviton has the form $$V_{\rm graviton} = \epsilon_{\mu\nu}\partial_\alpha X^\mu (\sigma)\partial^\alpha X^\nu(\sigma)\cdot \exp(ik\cdot X(\sigma)).$$ The exponential, the plane wave, represents (the basis for) the most general dependence of the wave function on the spacetime, $\epsilon$ is the polarization tensor, and each of the two $\partial_\alpha X^\mu(\sigma)$ factors arises from one excitation $\alpha_{-1}^\mu$ of the closed string (or with a tilde) above the tachyonic ground state. (It's similar for the superstring but the tachyon is removed from the physical spectrum.)

Because of these two derivatives of $X^\mu$, the vertex operator has the same form as the world sheet Lagrangian (kinetic term) itself, with a more general background metric. So if we insert this graviton into a scattering process (in a coherent state, so that it is exponentiated), it has exactly the same effect as if we modify the integrand by changing the factor $\exp(-S)$ by modifying the "background metric" coupling constants that $S$ depends upon.

So the addition of the closed string external states to the scattering process is equivalent to not adding them but starting with a modified classical background. Whether we include the factor into $\exp(-S)$ or into $\prod V_i$ is a matter of bookkeeping – it is the question which part of the fields is considered background and which part is a perturbation of the background. However, the dynamics of string theory is background-independent in this sense. The total space of possible states, and their evolution, is independent of our choice of the background. By adding perturbations, in this case physical gravitons, we may always change any allowed background to any other allowed background.

We always need some vertex operators $V_i$, in order to build the "Fock space" of possible states with particles – not all states are "coherent", after all. However, you could try to realize the opposite extreme attitude, namely to move "all the factors", including those from $\exp(-S)$, from the action part to the vertex operators. Such a formulation of string theory would have no classical background, just the string interactions. It's somewhat singular but it's possible to formulate string theory in this way, at least in the cubic string field theory (for open strings). It's called the "background-independent formulation of the string field theory": instead of the general $\int\Psi*Q\Psi+\Psi*\Psi*\Psi$ quadratic-and-cubic action, we may take the action of string field theory to be just $\int\Psi*\Psi*\Psi$ and the quadratic term (with all the kinetic terms that know about the background spacetime geometry) may be generated if the string field $\Psi$ has a vacuum condensate. Well, it's a sort of a singular one, an excitation of the "identity string field", but at least formally, it's possible: the whole spacetime may be generated purely out of stringy interactions (the cubic term), with no background geometry to start with.