How to tell if someone has used jailbreak to access your iPhone or put spyware on your iPhone?

Is there any way to tell if someone has used jailbreak to access your iPhone or put spyware on your iPhone?

Most cell spyware works in stealth mode.
you can factory reset it to get rid of such apps.