They cannot detain you. Cops can detain you, Target staff can insist you have to stay, but they cannot easily and practically bar you from leaving.
They can initiate a citizen's arrest, which would permit them to detain you But if they are wrong, and you've committed no felony, that guard is civilly and criminally liable for false imprisonment -- a pretty serious charge. Most store security are unwilling to risk their own personal necks to protect the company's interest in $20 of shampoo or whatever.
In IL, a "shopkeeper" can definitely detain someone:
> (a) Detention. Any merchant who has reasonable grounds to believe that a person has committed retail theft may detain the person, on or off the premises of a retail mercantile establishment, in a reasonable manner and for a reasonable length of time for all or any of the following purposes:
> (1) To request identification;
> (2) To verify such identification;
> (3) To make reasonable inquiry as to whether such person has in his possession unpurchased merchandise and to make reasonable investigation of the ownership of such merchandise;
> (4) To inform a peace officer of the detention of the person and surrender that person to the custody of a peace officer;
> (5) In the case of a minor, to immediately make a reasonable attempt to inform the parents, guardian or other private person interested in the welfare of that minor and, at the merchant's discretion, a peace officer, of this detention and to surrender custody of such minor to such person.
https://ilga.gov/Documents/legislation/ilcs/documents/072000...