What are the Electrical Specifications of GPIO pins; current limits and voltage levels?
There is no OFFICIAL published electrical specifications for the Broadcom SOC, however there are a number of sources.
One which can be considered authoritative is by Gert van Loo (who did the hardware engineering for the alpha boards). "All the electronics of the pads are designed for 16mA. That is a safe value under which you will not damage the device. … Other than that there is no guaranteed maximum safe current." An extract is on the Foundation website.
GPIO Electrical Specifications is a good attempt to determine what the electrical characteristics are.
Understanding Outputs provides some explanation and the results of actual measurements on the Pi.
The sources are all based on the original Pi, but the peripherals of the SOC used in all Pi models are identical, only the CPU differ.
In simple terms you can safely draw 16mA from a GPIO pin (the default is 8mA with defined logic levels, but this can be reconfigured). There is no defined limit for total current, and with the modern power supply you could, in principle, draw this from all 26 pins, but prudent design would suggest a more modest limit.
The Pi 3.3V rail is widely claimed to provide 50mA, and each pin 3mA. Gert van Loo explained that these were design values; the circuitry was designed so each of the 17 pins could supply ~3mA, ~51mA in total. This applies to the original Pi A & B; the B+ and later (with 40 pin header), including the Pi Zero, have no such limit.
Input and Output levels are now published Voltage specifications
The I/O ports have two parameters which deal with the input level:
VIL: The maximum low level voltage. (0.9V on the CM)
VIH: The minimum high level voltage. (1.6V on the CM)
Input levels are typically
Low should be <= 0.9V.
High should be >= 1.6V.
VOL: The maximum low level output voltage. (0.14V on the CM)
VOH: The minimum high level output voltage. (3.3V on the CM)
A detailed explanation of the Raspberry Pi Power Limitations