Pigmen can spawn in two different ways when the difficulty is set to easy, normal or hard: They spawn in the nether via the random mob spawn algorithm (link needed) and have a chance (which) to spawn inside nether portals when a nether portal block receives a random update aka. plant grow update.

stuff needs to be added here