The many uses of とする

とする has four main uses. The first means that someone supposes/assumes something, used with statements. Think of it like "pretend that/act as though". This is easiest to see as an invitation, but can be part of a longer sentence about someone else's presumptions too.

それが本当だとすればどうなるのだろうか。
Assuming that was true, I wonder what will happen

誰かが呼びに来たとしても不思議ではない。
Even assuming someone came here to call (us?), it wouldn't be strange.

The second is a として auxiliary, with a general vague "operating as X" meaning. This is directly related to the first use, think of it like "thinking of Y as an X". In this usage it commonly goes directly after nouns.

その判断は医者として間違いではなかった。
That decision, as a doctor, was not a mistake.

The third use means that something undergoes an "experiential" state, basically used with "mimetic" words like つるつる "slick". Mimetic means words that represent sounds (onomatopoeias) or sound-like attributes.

頬がぴりっとする。
I felt a tingle on my cheek.

Lastly, とする can show up after a verb in volitional form. This can give it two separate, but often similar, meanings.

The first meaning is that of something that is "about to happen". Either as a volitional action under the control of the subject, or as something involuntary and unavoidable (like an act of nature, etc).

本部を出て行こうとした時、アルフォンスに呼ばれた。
As I was about to leave the main headquarters, I was called by Alfonse.

そんな時間も終わりを迎えようとしている。
That time was also about to reach its end.

The other meaning is closer to "attempting to do something" and can be only used for voluntary actions.

本気で僕を食べようとしているらしい。
It seems like it was seriously attempting to eat me.

When the verb is a voluntary action, sometimes the line between the "about to" and "attempt to" meaning can be ambiguous. If you think about it, if you are attempting to do something but fail because you get interrupted, you were also about to do it. So the construction can assume both meanings at the same time:

俺が再びご飯を食べようとした時、ガタッと音がする。
As I tried to eat my meal again, I heard a rattling sound.
As I was about to eat my meal again, I heard a rattling sound.