I apologize for the lack of hyperlinks, I do not have rights to add them :(
You are asking for two things here.
1) FFT explanation
Very briefly:
If you want to get a representation of the frequency domain of a signal using the Fourier transform, this is a mathematical transformation that converts the signal from the time domain to the frequency domain. When working with digital signals, we have a set of discrete samples, so we must use a discrete Fourier transform or DFT. However, this is a rather slow operation and is easily optimized, so instead we use the fast Fourier transform algorithm or FFT.
This is a big topic in signal processing, so I suggest you look for a signal processing book to use as a reference. I suggest Digital Signal Processing: A Practical Approach. There is, of course, a widespread Wikipedia article.
2) FFT implementation
Due to the highly optimized nature of FFT platforms and languages, specific implementations often arise, you should check the headers and documentation (as a rule, it will be found in the "audio" section) if it is included in the standard library.
If you want to implement the algorithm yourself, I recommend finding a copy of Numericical Recipes, which contains a whole chapter on FFT, as well as the chapter "Fourier Applications and Spectral Applications". There is a well-documented pseudo-code that should be easily translated into any language.
A popular choice for a third-party solution is FFTW, Library C. I am looking for google for the “FFT Library” to provide you with some alternatives.
PAK-9 source share