If you're looking at evolutionary timescales, then the only available source of information is the target organism's genome sequence. At least some of the methods of horizontal gene transfer you mention leave a distinctive signature in the genome. For example, retrovirus particles that have become incorporated into the human genome are easily identified by their local DNA sequence.
So in terms of an experiment, you would sequence your specific gene of interest as well as the surrounding local sequence (say, 10,000 base pairs downstream and upstream of your gene). In at least some cases you would be able to say for sure "this gene arose from retroviral incorporation", whereas in others it would be more ambiguous.
Belshaw, R. et al. Long-term reinfection of the human genome by endogenous retroviruses. PNAS (2004)