One important note is that rocketry predates space travel - by a lot. The V-2 rocket christened "MW 18014", the very first suborbital flight, (meaning the rocket flew to space, but didn't go fast enough to orbit the earth, so came back down) was in 1944. This rocket was designed to launch, fly in a specific trajectory, and land in a (relatively) specific location - and it worked. It didn't "do" anything, it had no practical payload. But it worked.
By 1944 our knowledge of physics/astrophysics was fairly advanced - we understood quite well that orbits are just a matter of going really fast around a celestial body. So, armed with a rocket that can fly into space, and knowledge of how orbits are made, spaceflight was a very natural next step.
It took quite a few tests like the one linked above to understand the engineering behind the first rockets, but for the most part rockets' trajectories, the physics of space, and the nature of vacuums were already known. It was just that these things were mostly known by theoretical scientists - not by engineers. So the first spaceflights were mostly just applying the theoretical understanding we already had of how an object might go from the ground to an orbit around earth.
It should be noted that while I make it sound simple, the actual engineering that went into making real spacecraft was very, very hard. To more directly answer your question about how humans found out how to deal with the unique challenges of space travel; we iterated for a long time. It took 13 years between MW 18014 and the successful flight of Sputnik 1, which was the first manmade object to orbit the Earth. 13 years is a long time to iterate on a design - even accounting for the chaotic political effects of the end of WW2 and the diffusion of German knowledge after it.
The way we learned about how to make a craft that could take a person into orbit was by actually sending objects up to space; rocket scientists were simply launching more and more satellites into the atmosphere to study the environment. By the time Yuri Gagarin became the first man in space in 1961 - a good four years after Sputnik - scientists already had a lot of experience sending rockets into orbit and dealing with the crazy effects of space travel.
tl;dr the way people learned how to deal with space was by shooting rockets into it until they figured out how it worked. Then they shot people into it.