Re-arrangement of brain's functions In a neuroscience class, I was told that if some part of the brain gets damaged somehow and it's early enough, the functionalities of that part of the brain are rearranged to another part of the brain. This was used to prove that all parts of the brain utilize the same general mechanism. 

Now my questions are: 

1. How does the brain get assigned these locations initially? Is it genetics?
2. If the functionality is reassigned, won't it affect the place where it is now put? 
3. How does the brain decide where to put it? Is the brain self aware?
This was used to prove that all parts of brain utilize same general mechanism.


This is not quite true. While a good deal of reorganization can happen post-damage, brain function will not be re-localized to anywhere. Instead, what often happens is that, if a location on one hemisphere is damaged, the function is taken over by the corresponding location on the other hemisphere. In the extreme, some children have an entire hemisphere removed (to treat seizure disorders), and the remaining hemisphere takes over nearly all the function of the removed hemisphere. Hopefully this partially answers your second question.

To answer your first question, both genetics and environmental input shape how functions get localized in brain tissue. We know environmental input is important because people that are deprived of some kind of input (e.g., vision or sound) will re-assign the brain tissue to processing input that is received (so for a Deaf person, auditory regions in temporal lobe may be repurposed for processing visual input). I can't, off the top of my head, think of concrete cases to illustrate how genes influence function localization, but hopefully it's obvious enough that this is the case / how this might work.

Re: your last question about the brain being self-aware...well, in one sense the brain is self-aware since you are self-aware and you are your brain. But we must be careful about what exactly we mean by "self-aware". It can be easy to fallaciously invoke the homunculus.