Whenever you go through a nether portal, the game divides your current coordinates by 8 and puts you at the nearest portal to that. Only if there are no portals within a huge area around there will it make a new one, so be prepared to come out of someone else's portal.
Equally, the chances are that when you go back in the portal you came out of (which could be a long way away) the game multiplies by 8 and puts you through the nearest portal, which may not be the one you entered by.
If you want to make sure you come back out of the portal you made to get in, take note of the coords of your overworld portal and go to exactly those coordinates divided by eight and build a second portal.
If you make a portal in the nether outside of the overworld boundary (currently 1000 blocks within the nether), or the portal creation algorithm tries to place you outside of the overworld border, when you go through the portal you will be sent straight back to the world border.