  Measurements of cosmic microwave background spectral distortions have
profound implications for our understanding of physical processes taking place
over a vast window in cosmological history. Foreground contamination is
unavoidable in such measurements and detailed signal-foreground separation will
be necessary to extract cosmological science. We present MCMC-based spectral
distortion detection forecasts in the presence of Galactic and extragalactic
foregrounds for a range of possible experimental configurations, focusing on
the Primordial Inflation Explorer (PIXIE) as a fiducial concept. We consider
modifications to the baseline PIXIE mission (operating 12 months in distortion
mode), searching for optimal configurations using a Fisher approach. Using only
spectral information, we forecast an extended PIXIE mission to detect the
expected average non-relativistic and relativistic thermal Sunyaev-Zeldovich
distortions at high significance (194$\sigma$ and 11$\sigma$, respectively),
even in the presence of foregrounds. The $\Lambda$CDM Silk damping $\mu$-type
distortion is not detected without additional modifications of the instrument
or external data. Galactic synchrotron radiation is the most problematic source
of contamination in this respect, an issue that could be mitigated by combining
PIXIE data with future ground-based observations at low frequencies ($\nu <
15-30$GHz). Assuming moderate external information on the synchrotron spectrum,
we project an upper limit of $|\mu| < 3.6\times 10^{-7}$ (95\% c.l.), slightly
more than one order of magnitude above the fiducial $\Lambda$CDM signal from
the damping of small-scale primordial fluctuations, but a factor of $\simeq
250$ improvement over the current upper limit from COBE/FIRAS. This limit could
be further reduced to $|\mu| < 9.4\times 10^{-8}$ (95\% c.l.) with more
optimistic assumptions about low-frequency information. (Abridged)
