It is rather simple... each improvement belong to one or more categories. If any building next to them give a bonus to that category they gain a number of levels depending on what adjacency bonuses those buildings give.
So... a "basic factory" is a Manufacturing improvement, they also give +1 level to any other adjacent Manufacturing improvements. So in this case any other "basic factory" adjacent to them gain one level. If you for example build three factories in a triangle shape they all have two other improvements adjacent that give them a level and thus all factories will be level two.
Special terrain traits work the same. They either give a specific bonus to a certain type built in the hex and a different bonus to anything built next to them.
A research lab only give adjacency bonus to research improvement so they will not give any help to a factory built next to them, the opposite is also true.
If this make any sense to you? 