When. Among the morning and evening remembrances. Nothing in it is tied to a place or an event, and it is meant to be said by someone who considers himself a believer — that is the assumption the second half rests on.
The words. Ushrika is from sh-r-k, the root of partnership and of the shareholder. Shirk is therefore not disbelief in Allah but the assignment of a share in Him to something else — a portion of what belongs to One given away. That is why it can happen inside a life of prayer without any visible change of religion.
Two halves, two different requests. The first half seeks refuge: a'udhu bika an ushrika bika wa ana a'lam — from doing it knowingly. The second half does not seek refuge at all; it seeks forgiveness for what is done unknowingly. The switch is the architecture of the whole supplication. You can be guarded against a thing you would recognise coming. You cannot be on guard against what you cannot see, so for that half the only available move is to ask that it be covered.
What the second half assumes. It takes for granted that a sincere person carries something of this he has not noticed — a reliance on a means rather than on the One behind it, an act shaped by who is watching, a fear given more weight than it deserves. The supplication does not enumerate these, and it does not have to; the point is precisely that they are not visible from inside.
Its tone. Nothing here is dramatic. It is a short, sober sentence that treats the most serious matter in the religion as something requiring maintenance rather than a single decision made once.