The brain consists of a total of 10,000,000,000,000 nerve cells, or neurons. Each neuron makes several connections to other neurons, and this enables them to communicate with one another. The communication is mediated by neurotransmitters, a type of chemical messengers released by neurons and received by other neurons. This process relays signals on to the brain.
Drugs can have many different effects on how such signals are transmitted. Drugs may intensify or prolong the signals, leading to overactivity in the network. This can produce feelings such as euphoria.
The animation Drugs and the Brain shows more detailed information about this process.