Summary:
Your spies can steal technology from a more advanced civilization. To attempt to steal technology, first, move a spy to a target city within another civilization. Once the spy arrives, there will be a period of time where they are "Establishing Surveillance" (noted in the "Activity" column). Once surveillance is established, you will know whether the target has technology that you can steal. If they do, the time it takes to steal the technology depends on how much science the target city is producing, and the rank of your spy. The higher your rank, the more quickly you will be able to steal technology. The higher the science output, the faster your spy can work.
Other factors that can affect the time it takes to steal technology includes defensive buildings like the Police Station or the Great Firewall wonder, which can stop a spy completely. Additionally, if the target has placed a defensive spy in the same city, your spy can be caught, or even killed (he will be taken out of action for multiple turns). This, of course, will have a negative effect on your diplomatic relations with the target civilization.