Andy Weir is a software engineer turned science fiction author who has always been incredibly interested in orbital mechanics, relativistic physics, and the history of manned spaceflight. When writing The Martian, he would do more research than writing, trying to get everything correct. He made software to model thruster burns for the ship’s ion engines, analyzed NASA’s orbiting satellites to see what could be relevant to the character's 3,200-kilometer journey, and provided a detailed formula of the process of reacting oxygen and hydrazine to make water.
Read an interview with Andy Weir.