If you have a detector in battle I know you can distinguish between hallucinated units and the real ones. But will your units ignore the hallucinated units and only focus on the real ones?
Your units will prefer to attack real units if they are in range of both and the illusions are detected. If they are only in range of illusions they will attack illusions. I believe that they also will switch away from attacking illusions if a real unit enters range, but I will try and find a source on that.
Liquipedia has the following quote: