The idea of the silencer is that there is a material inside the tube which absorbs the sound, this also determines how strong the silencing effect might be. The lenght and circumference play a big role when choosing your silencer where as the longer the silencer is the better the silencing effect might be. Although the silencer will also increase the total lenght of the your gun, making it bit harder to handle, specially with pistols.
Besides the muffling effect the silencer also bring lot of new look upon the guns. With real guns the silencer soften the loud bang but in airsoft guns they muffle the sound much less which makes it harder for your opponents to detect your position.
The most common way to attach silencers to your gun is by screwing it on to the -14mm threads (counter clock wise) which can be found in majority of the modern guns. In the other end of the silencer there are +14mm, meaning that there is not really anything stopping you to mounting a silencer to your gun anymore.
These threads are now days a common in most of the AEGs and also in some gas pistols as well. The threads are hidden under the flash hiders or thread covers. If you cannot find any suitable threads, there are adaptors available.