Essentially an inverter works by connecting a transformer to a DC supply via a series of switches - the idea being that the transformer is connected to DC for a short period of time, the switches then change over so that the positive and negative connections are reversed. In modern electronic inverters the switches are solid-state devices - in low-power devices like domestic UPSs these are MOSFETs, in industrial devices these may be GTOTs or IGBTs.
Essentially, the transformer gets AC power in, and AC power must come out. In some industrial systems, (e.g. variable speed motor drives) a transformer is not necessary, and the switches can be connected directly to the load.
The simplest circuit to describe is the 'H bridge' - so called because it looks like an 'H'. See
here. This would work by closing switches S1 and S3 and opening S2 and S4. Then opening S1 and S3 and closing S2 and S4. This provides a Square wave.
To produce a sine-wave, instead if simply closing the switches - pulse-width modulation (PWM) is used. The switches are opened and closed at high frequency (e.g. 20 kHz) with the on-time being varied - so that near the peak of the wave the switches spend most of the time on, but near zero volts they are swicthed off for most of the time.