It is an impressive undertaking to time the arrival of a spacecraft at a distant planet in such a way that, like a billiard ball, it swings by the planet at exactly the right time to within a few minutes accuracy in time, and a few kilometers accuracy in space, after traveling for a year or more and 100's of millions of miles. But these calculations are not that complicated to do, and good results can be obtained even with some of the software now available on the Internet as shareware/freeware. The software that 'astrodynamicists' use is, of course, far more complicated and takes into consideration the true positions and speeds of thousands of bodies in the solar system, plus the detailed shape of the gravity fields of the Sun and the planet being used in the maneuver.
The calculation is in two parts. You have to calculate the part of the trajectory that takes the spacecraft from Earth orbit to the orbit of the planet, called a Hohman Transfer Trajectory. You then have to calculate the part where the spacecraft actually encounters the gravitational field of the planet. The timing has to be very carefully worked out. As seen from the Earth, the satellite has to arrive at the planet at a very specific 'impact parameter' ( ie distance from the center of the planet) and velocity. These initial conditions then determine the exact 'slingshot' path the spacecraft will take around the planet, and its final speed and direction as it emerges from the encounter. It is a bit tricky. That's why you need to know exactly where the planet is to a kilometer and minute accuracy or so, and of course you have to make certain that the spacecraft gets there exactly at the right time.