> I would like to be able to determine, for a given position(lat and
> long), in which polygon that position is located.
There are well-known algorithms
http://www.google.com/search?q=point+in+polygon+testing
> For example, if a have a KML file in which every state is represented
> by a polygon, I would like to be able to tell in which state a given
> set of lat and long is located.
You can parse the KML to extract the poly coordinates into whatever
environment you are working in.