Largely I agree you've either got it or you haven't, BUT I think practicing as you grow is part of it and that being well read/having a good command of the English language definitely helps.
Partly cultural too I think - there's a reason most comedians are working class! And the ones that aren't generally seem to me to have to work harder at it. Yes comedians spend a lot of time and work developing routines that flow, but the best ones are spontaneously funny too - you see the difference most publicly on chat shows. There are certain comedians that don't like appearing on them BECAUSE they know they struggle to be spontaneously funny. Comedians themselves recognise this, stating there are working comedians and those with "funny bones".
I think having a hard time growing up and therefore having perhaps distracted bullied with humour also helps develop the skill. I was a short, skinny weird looking kid and due to being an army brat, frequently the new girl and seemingly an easy target for bullies. I learned to talk/laugh them out of targeting me.
I agree with UniversalTruth more commonly comes from INsecurity!
Dd frequently now catches me with a sarcastic/witty response, if I challenge her she reminds me I taught her! Equally I remind her she's still very much a learner 😉
"Some of the wittiest people I know have the least of education. I don’t think it’s anything at all to do with education" lacking the recognised proof of being well read =/= not being well read. My parents and all grandparents all left school with few qualifications before age 16, all 6 VERY well read and I don't mean just reading bestsellers! One granpa particularly liked Russian novelists and philosophy. His wife read a lot of history including uk political history... Don't assume.
"Didn't sleep well last night" it's said a clear conscience makes for a better rest - but far less interesting dreams I think 😂
One wit I love/d was someone who was very well read and quick witted but few knew it. George michael. 2 examples in his autobiography -
Upon being criticised for being too 'lightweight' by mucking about on stage with Ridgely stuffing shuttlecocks down their shorts he responded something like "what did they expect? We were playing the pop star stereotype I'm not gonna start reciting the gormenghast trilogy!"
Regarding their trip to China, portrayed falsely he felt, by the Chinese govt as their becoming more "open" to western influence, while the Wham! Contingency were acting equally cynically and selfishly he seemed to not be paying much attention. Then upon seeing a Coke can shoved in a Classical Chinese statues mouth he stated something like "pretty much sums up what we're doing here".