Welcome to e health forum.
Pregnancy can occur, only when ejaculation occurs within the vagina, and you are within the fertile period of your cycle.
Normally during sex, when ejaculation occurs inside the vagina, about 3 ml of semen (with upto 60 million sperms per ml) is deposited inside the vagina, and most of it is ejected into the uterus, through the cervix. But only thousands of capacitated sperms enter the fallopian tube and only 300-500 reach the ovum, and only one of those sperms can fertilize the ovum.
Hence when small amount of semen comes into contact on the clitoris or outside the vaginal introitus - the chance of pregnancy is very rare. This is due to the fact that sperms have to travel a long distance from the external genitalia to the fallopian tubes where conception occurs.
But you need to keep in mind to follow safe sex and always use condoms or emergency contraception in order to to avoid pregnancy.
Remember, knowledge is power and knowledge of what can cause pregnancy and the steps you can take to prevent it will make you more calm and more able to explore your sexuality with confidence.
I hope this helps.