Based on my neurology classes, I feel like we have some idea what some parts of the brain do. Obviously full on experiments would be unethical, but we can like, observe which neural pathways formed in people with the same life style (so Taxi Drivers have larger and more developed sections focused on navigation). We can observe what happens to people who take the same kinds of damage, and occasionally we get lucky and we can see what happens to people with grievous injuries or rare maladies. Also, we can do experiments on creatures like snails which far less complex brains.
The brain is certainly an interesting a weird black box, but we do have outs to learn some things