I think your question covers a lot of ground cause you're asking it from 2 different perspectives.
How were the orbits of planets first mapped out?
How do we know what position in space a planet will be at certain time
so that spacecraft trips to planets could be planned etc.
These should probably be separate questions, as they're quite different.
First one first, here's a bit of history: Using parallax Hipparchus was able to get a pretty good estimate of the distance to the Moon about 200 BC. The distance to the sun was much more difficult but Aristarchus was the first to come up with a method and others were able to improve upon it to get more accurate measurements.
The relative orbits of the planets wasn't hard to calculate once you had one of them, more on that here.
We can measure the length of a year on Mercury or Venus quite easily, as well as their relative angle to the sun (though Mercury's orbit is quite eccentric, you'd want to take several measurements). Even the wacky Copernican model with just circles on top of other circles made pretty good distance calculations with the sun in the center and the planets orbiting the sun.
Kepler was the first to recognize that the planets orbited at slightly different orbital planes, and from what I've read, Kepler was prouder of that discovery than the discovery of the elliptical orbits that he's most often remembered for. The combination of slightly different orbital planes and elliptical orbits and Brache's improved accuracy to his measurements was a huge step forward in planet mapping. Kepler still didn't have the distance to the sun well plotted out, but he figured out the model for planetary orbits. After that, it was just a matter of improving the distance measurements.
As to how NASA does it now. I'm not an expert, so somebody else might be able to answer that one better. It gets pretty mathematical, 3 position vectors, 3 direction vectors and velocity changes based on position, but we have nearly pinpoint laser measurements now.
I'd also like to know the most primitive way that this could be done
and if there is anyway this could be done using only maths and simple
measuring tools assuming no previous knowledge about the planets
It depends what you mean by primitive. Galileo's telescope enabled him to see phases of Venus, and that isn't possible without a telescope. The telescope also made it possible for Galileo to see 4 of Jupiter's moons, which orbited Jupiter and not Earth.
Aristarchus tried to eyeball the difference in shadow from the sun between the earth and the moon and he estimated the Sun was some 18-20 times more distant than the moon. Details here. To his credit, he successfully deduced that the Sun is much further than the moon, and he estimated the angle ratio to be 87 degrees when it was 89.83 degrees. Despite his efforts, his estimate was off by a factor of about 20, in distance though he was only off by 2.83 degrees.
Brahe used the best equipment available to him at the time, much of it made specifically for his observations. More on that here. Brahe also had the advantage of having accurate time pieces.
Brahe believed in the Ptolemaic model but he was unable to get it to match his data and he urged Kepler to figure it out when he was old and knew he wasn't going to figure it out himself. (There are rumors that Kepler poisoned Brahe to get more credit for himself, but I don't think that actually happened, Brahe's body was even exhumed to test that theory some time later but no traces of poison were found).
Kepler, unlike Brahe, liked the Copernican model but he couldn't get that to work because he believed in Copernican circles. He tried ellipses, more out of desperation because he couldn't get circles to work and the ellipse model matched the data. Kepler had not only Brahe's but years of Copernicus' records to work with as well as observations preceding them, some going all the way back to ancient Greece.
I'm not sure it would be possible to figure out that planets have elliptical orbits and how far they were from Earth without good equipment. Kepler had a lot to work with and a determination to find a simple explanation.
Hope that's not too wordy. I can try to clean it up a bit later if you like.