If I have an input of ac current 50/60 hertz into a capacitor of 40nanofarads and after that a rotary spark gap(2000-5000 discharge per second) , what would be the waveform of output? And how will the waveform change in case of static spark gap? I am trying to understand tesla coil.
The waveform from the spark gap has little effect on the operation of the Tesla coil. Think of it as just a high voltage switch turning on and off 100-120 times per second. Theoretically it would be a square wave with a sine wave laid over it, but in reality it is very noisy. I just think of it as a "burst" of current flowing into the primary tank circuit consisting of the resonant capacitor and primary coil. This "burst" excites the LC circuit causing it to oscillate at a frequency determined by the formula,
where F is the frequency in Hertz, L is the inductance of the primary coil in Henrys, and C is the capacitance of the primary capacitor in Farads. This oscillation on the primary coil induces a current in the secondary coil, which excites the secondary tank circuit (made up of the secondary coil - 'L' - and the capacitive topload - 'C'). If both the primary tank circuit and the secondary tank circuit resonate at the same frequency, the voltage induced on the secondary coil adds up every cycle (constructive interference of the waveforms) and that's how you get such a high voltage on the output.
The spark gap is only used to energize the tank circuit and excite it repeatedly. The waveform is not terribly critical, but just picture it as a square wave (on - off - on - off). In reality there is an oscillation laid over this "square" wave and it is very noisy.