The notes of G9 are G, B, D, F and A. G is the root, B the major third, D the fifth, F the minor seventh and A the ninth.
String by string, low to high, it plays G, B, D, A, B and F. B appears twice in the main shape, and it is the chord's major third. It runs from G on string 6 up to F on string 1.
The open strings add notes to G9 too. String 4 gives D and string 2 gives B. Your hand covers three frets, from 1 to 3. This page has three positions. The others start at frets 2 and 10.
Change only string 3 in G9 and you have G7. Inside G9 sits a complete Dm chord, made of D, F and A. Bm shares one position with this shape.
G9 belongs to only one key, C major, where it is the V9.