How is a pin designed to be analog or digital on a Arduino/Raspberry Pi board?
Those analog pins has an ADC embedded in them. Generally, a single pin is connected to a lot of Peripherals, the GPIO (General Purpose Input Output) peripheral is responsible to give a digital output or digital read. Most of the pin has GPIO MUXED in them.Other example of peripherals are PWM, CAP etc. For Analog read, we have ADC peripheral. The number of ADC peripheral are limited in number, but single ADC has multiple channels, which means the ADC can only convert one channel at a time. 

You can learn about them from their respective Datasheets and Technical References.