Word for "observing something with the purpose of gaining knowledge from it"?

If informal usage would work for you you could use:

stake out as a verb:

they’d staked out Culley’s flat for a day (ODO)

He spent several nights staking out the terrorist's building.


Surveilling: verb (transitive) 1. to observe closely the activities of (a person or group)

http://dictionary.reference.com/browse/surveilling?s=t


The act of checking out a location, particularly in the context of the military, is called reconnoitering. One can also make a reconnaisance of a place, like before attempting to occupy it. (M-W)


He spent several nights casing the terrorist's building.

Appropriate if the surveillance is done in anticipation of a crime, especially a robbery. Also applies specifically to places or locations, not people nor things therein. (For example, you case a bank, but not a bank manager nor a bank safe.)

From Merriam Webster:

to study or watch (a house, store, etc.) with plans to rob it

From Oxford Dictionaries:

informal Reconnoitre (a place) before carrying out a robbery