In case you were afraid that your sexy new T-Mobile G2 wouldn't be able to run custom ROMs or take screenshots when it arrived, fear not - hendusoone, xda-developers forum member is here to save the day. For now, the root process isn't as simple as some, and its effects only last until you reboot the device, but if you're desperate to start rooting, here's what to do:

Download this file

On PC:
adb push rageagainstthecage-arm5.bin /data/local/tmp
adb shell
cd /data/local/tmp
chmod 0755 rageagainstthecage-arm5.bin
On G2:
Open terminal emulator
cd /data/local/tmp
Wait a bit for it to say "Forked #### childs." Then hit enter. Should have a $ prompt.
Try running "ps" - should say Cannot fork.
Exit terminal emulator with back button, launch an app (I launched Twidroid, probably doesn't matter which app you pick)
Launch Terminal Emulator again - it will force close, hit Force Close
Launch Terminal Emulator a second time and you have a root shell

Source: xda-developers via Engadget