This is the first time I have considered this verse so I don't feel as confident as I would like in my answer. But it may be that spirits here refers to the angels or a group of deceased human kings, and demons to the spirits of Nephilim.
I think we can find a good indication of this from Eusebius.
"Thus then at length the terrestrial daemons, and 'the world-rulers' that haunt the air, and the 'spiritual hosts of wickedness,'
2 and the leader of them all in malice, were regarded among all men as the greatest of gods; the memory also of those long dead came to be thought worthy of greater worship." (
Praeparatio Evangelica book 5 chapter 2. )
I take the world rulers to be angels. I am not sure of what 'spiritual hosts of wickedness' refers to, but given the context of Eusebius's statement it could be the spirits of wicked kings worshiped as gods. Many human kings were viewed as gods even while alive, and many went through rituals of dedication that authorized them as rulers on behalf of demons or angels. (you can get a clearer view of that system of ritual
here. Ninurta, as described here, is probably Nimrod) Isaiah 14:9 talks about the rephaim rising up to meet the king of Babylon so maybe Eusebius sees a group of humans as in league with the Nephilim spirits and that might be what is refereed to in Timothy.
In regards to the reference in idolatry, the Nephilim were worshiped as gods. The Nephilim were mighty men of renown, the kind people turned into gods. Eusebius draws that out further in the first few chapters of what I linked above. I think of the gods that people worshiped, most were Nephilim but some may have been fallen angels. In particular I have in mind Enlil.