If "Produce X" is in the queue anywhere, it adds the bonus as if the city was producing whatever is there. This only works if the "Produce X" is the most recent thing chosen, but it can be at the back of the queue.
Here's Aster (conclave) with no production going on:
46 Research
13 Gildar

I add "Produce Research"
59 Research
13 Gildar

Then I add something else - in this case a guardian statue. It goes before the Produce Research, but I still have the bonus
59 Research
13 Gildar

I swap to "Produce Wealth" and I get the bonus from the Produce Wealth and the bonus from Produce Research. It only sticks around if it is replaced when it's the last item in a queue and there's still something in front of it.
59 Research
19 Gildar

One turn later, I still have the benefit of "Produce Research" even though it's gone

Steps to reproduce:
Start building something in a city
Add "Produce Research" to the end of the queue - you should see the research go up
Add "Produce Wealth" to the end of the queue - you should get both research and gildar as if both were being produced even though you're building another structure