Electrical brain stimulation is a technique with a large potential to study brain activity and treat a variety of pathological conditions. Despite its wide use, many open questions remain about the underlying mechanisms. For instance, it is not fully clear how electrical stimulation affects the activity of neuronal populations in-vivo and whether behavioral states modulate such effects. Here we aimed to fill this knowledge gap developing and using cutting edge tools to stimulate the mouse brain as well as state-of-the-art imaging techniques to monitor neuronal activity and gain a deep understanding on how electricity alters brain function. Furthermore, computational models were developed to understand the basic mechanisms of interaction between electricity and neurons. Insights from this work will likely shed light on the realm of possible effects of electrical stimulation, and on how brain activity could be shaped to achieve specific behavioral outcomes. Ultimately, this knowledge may lead to the rational design of stimulation protocols that could be applied in humans, ideally non-invasively, to restore brain functions.