Hearing aids are fairly simple devices, consisting of four basic parts:
A microphone picks up sound from the environment and converts it into an electrical signal, which it sends to the amplifier.
An amplifier increases the volume of the sound and sends it to the receiver.
A receiver/speaker changes the electrical signal back into sound and sends it into the ear. Then those impulses are sent to the brain.
A battery provides power to the hearing aid.
Hearing aids aren't effective for everyone. Hair cells in the inner ear must pick up the vibrations that the hearing aid sends and convert those vibrations into nerve signals. So, you need to have at least some hair cells in the inner ear for it to work. And, even if some hair cells remain, a hearing aid won't completely restore normal hearing.