Tampon question

How do I know when I'm supposed to take my tampon out? Also, is it normal to hurt like hell when taking it out?!