Used to change the subject or add a related remark in conversation or writing. Often appears at the beginning of a sentence.
sometimes; occasionally; on occasion
Adverbial use meaning 'at times' or 'now and then'. Can appear mid-sentence or at the beginning.
By the way, what time does next week's meeting start?
By the way, what happened with that matter?
He is sometimes late.
He sometimes says harsh things.
Just then, a big earthquake struck.
時に means 'sometimes' with a broader or more formal nuance, while たまに is the everyday word implying a lower, more casual frequency.
ところで is the more common everyday word for changing the topic, whereas 時に sounds a bit more literary or old-fashioned in this use.
時々 is the plain, common word for 'sometimes/often', while 時に in this sense feels more literary and slightly less frequent-sounding.
all at once; at the same time; simultaneously
From 時 (とき, 'time') + に (particle). The conjunction and adverbial uses developed from the literal meaning 'at the time'.