What is JTAG in regards to Android? I see the term JTAG used for reviving dead Android devices that otherwise don't respond to anything and aren't seen when USB connected.  It seems that it's something done from the physical hardware side of the device (as opposed to some pure software based solution) and I've heard the term used elsewhere (in gaming consoles).  I don't find much else about it, and I'd like to know specifically how it relates to Androids and similar devices.  It seems to be a term in electronics or electrical engineering, both of which I am unfamiliar with.  I'm wondering what it is and why it can be used on hard bricked devices.
JTAG and Android are two separate things.

You may find JTAG pins visible either under your device's battery or near its SIM / MicroSD card holder. The pins are hidden. You may have to dismantle your phone's back cover. The JTAG pins are usually six gold pins clustered close to each other, as shown in this photo:


Click to enlarge

You use a special hardware JTAG box which comes with a vast array of cables (different cables for different types of devices), plus specialized software specifically made for your device model. (There exist generic catch-all JTAG boxes that can be loaded with specific microcode instructions for your particular manufactured board. The tricky part is getting the exact microcode for your device's circuit board. If you use the wrong microcode, it can cause permanent damage.)

The microcode instructions are emitted by the JTAG box attached to the cable, clipped in position on top of the JTAG pins. The box sends a signal to your device to revive it. Now an appropriate firmware image can be flashed to your device.

This is a highly specialized topic. A background in electrical engineering can be handy, to know which pins are used for ground (GND), transmit (TX), receive (RX) and power (PWR). The power is the important one: if the battery is dead, power can still be fed into your device.

You can buy JTAG boxes online, but they tend to cost a couple hundred US dollars or so. It's because of differing manufacturers with different types of cables, and different arrangements of on-device JTAG pins.