A urinalysis should be done first. It is simple to collect some urine and the test is not very expensive. White blood cells and bacteria signify a bladder infection, and a bacterial culture should be done to select the best antibiotic. Sugar in the urine means further tests should be done for diabetes. Blood, crystals, or recurring bladder infections raise suspicion of bladder stones, and X-rays should be taken.
Cats can also get cancer in the bladder.
If all these things are ruled out the most likely diagnosis is idiopathic cystitis. The disease may come and go for no apparent reason. Some cats get it once and never again, and some hardly ever get over it. Each treatment probably worked at least once, in some cases because it was used just before the cat was going to get better anyway. Some of the treatments do more harm than good.