What kind of hardware implements Fourier transform?
Devices using the Fourier Transform


  It is very difficult for an electronic device to decompose a signal in different frequencies.


It's not. 

There's actually quite a few devices that do that, explicitly.

First of all, you'll have to make a difference between the continuous Fourier transform (which you probably know as \$\mathcal F\left\{x(t)\right\}(f)=\int_{-\infty}^{\infty} x(t)e^{j2\pi f t}\,\mathrm dt\$) and the Digital Fourier Transform (DFT), which is what you can do with a sampled signal.

For both, there's devices that implement these.

Continuous Fourier Transform

There's little in the ways of actual need for this in digital electronics – digital signals are sampled, so you'd use the DFT.

In optics and photonics you'll notice that there's an actual chance to get perfectly periodic things for a "large" (read as: nearly as infinite as the integral above) length. Effectively, an acousto-optic element can be excited with one or multiple tones, and it will have the same correlating effects as the integral above. You don't have to look at 2018's Physics Nobel Prize winners to find an example of Fourier Optics.

Discrete Fourier Transform

This is really all over the place; it's such a standard processing step that as a communication engineer, we often even forget where it is.

So, this list is far less than complete; just examples:


Equalizers: It's pretty easy building a digital audio equalizer with a DFT. Typically, the zero-forcing equalizer type for communication systems uses a DFT to find the frequency domain representation of the channel necessary to be "removed", inverts that and uses the IDFT to get back that back to time domain to be used as taps in a FIR filter.
Antenna Arrays / Beamsteering: If you have an array of antennas in fixed distance from each other, you can steer the beam of these antennas, by calculating the DFT of the "directional vector" you'd like to achieve and use the result as complex coefficients to be multiplied with the transmit signal that you distribute to these antennas. Real-world MIMO systems do that.
Direction Finding: What works in transmit direction works exactly the same, but reverse, in receive direction: Get a signal for each of your antennas in your array, find the complex factors between these signals, do an IDFT, get a vector containing the info how power came from which direction. Easy! And done for estimation where aircraft are, where Wifi communication partners are, submarines (though there it's not antennas but underwater microphones)…
Channelization: Satellites in space are expensive, so multiple TV programs need to be uplinked to one satellite. You can use a DFT (especially in an Polyphase Filterbank) to put multiple channels in one uplink, or to isolate individual channels from one wideband signal. That's not a domain of TV; it happens in audio processing, medical imaging, ultrasonic analysis, Radio broadcasting…)
Data Encoding for multicarrier systems: To combat the problems of wide channels (which you need if you want to transport many bits per second), namely the need for complex equalizers, you'd want to chop up your channel in many small channels (see "channelization" above). However, you can understand the DFT alone as Filterbank for frequency-shifted time-domain-rectangular filters. The nice thing about that is that these channels are very tightly packed. The other nice thing is that the convolution with the channel reduces to a point-wise multiplication which is super simple to revert. We call that method OFDM, and all Wifi, LTE, 5G, WiMax, ATSC, DVB-T, Digital Audio Broadcasting, DSL, and many more systems use that.
Efficient Filtering: A FIR filter is a convolution with the filter impulse response in time domain. As such, it uses a lot of operations per output sample – it's very computationally intense. You can greatly reduce that effort when you implement fast convolution, which is based on DFT'ing sections of input samples, mutliplying them with the DFT of the impulse response in frequency domain, overlapping with previous segments, and back-transformation to time domain. That's so handy that it's used in almost all systems that have long FIR filters (and "long" might start with so benign numbers as "16 taps").
Radar: Classical automotive radars use self-modulating FMCW radars; to get a picture of both the relative speed and distance of reflectors observed by that, you typically do a two-dimensional DFT (which really is just DFT'ing all columns of a matrix and afterwards all rows of the result). 
Audio and Image/Video Compression: Though JPEG uses the Discrete Cosine Transform, not the DFT itself, there's ample of codecs that mechanism which at least use significant parts of a DFT.


Note that the above list only contains things that do DFTs during operation. You can be 100% sure that during design of anything remotely related to RF, especially antenas, mixers, amplifiers, (de)modulators, a lot of Fourier Transforms / Spectral analysis was involved. Same goes for audio device design, any high-speed data link design, image analysis…

How is it done?

I'll just address the DFT here.

Usually, that's implemented as an FFT, Fast Fourier Transform. That's one of the most important algorithmic discoveries of the 20th century, so I will  spare but few words on it, because there's literally thousands of articles out there that explain the FFT.

You go in and look at the \$e^{j2\pi \frac nN k}\$ multipliers of a DFT. You'll notice that these can basically be understood as \${e^{j2\pi \frac 1N k}}^n=W^n\$; and there you have your twiddle factor. Now you avoid calculating coefficients that you've already calculated, and just swap a sign where necessary.

That way, you can reduce the complexity of a DFT from the $N^2$ (which would be the complexity if you implemented the DFT as the naive sum) to something in the order of \$N\log N\$ – a huge win, even for relatively small \$N\$. 

It's relatively straightforward to implement that in hardware, if you can get your whole input vector at once – you get \$\log N\$ as a combinatorial depth and fixed coefficients at every step. The trick is knowing how (whether) to pipeline the individual layers, and how to use the specific hardware type you have (ASIC? FPGA? FPGA with hardware multipliers?). You can basically piece together \$N=2^l\$-length transform only from what we call Butterflies, which you'll recognize once you read about the FFT.

In software, the principle is the same, but you need to know how to multi-thread very large transforms, and how to access memory as fast as possible by utilizing your CPU caches optimally.

However, for both hardware and software, there's libraries that you'd just use to calculate the DFT (FFT). For Hardware, that usually comes from your FPGA vendor (e.g. Altera/Intel, Xilinx, Lattice…) , or a large ASIC design tool company (Cadence) or your ASIC house.