How can a material at a certain temperature have all of its molecules at the same energy
A material at a certain temperature cannot have all of its particles at the same energy. In the basic definition of the word, “temperature” is the average random motional (kinetic) energy of the particles of a material. (Thermodynamics gives a broader definition to temperature, but we don’t need this definition here.) Did you notice the word “average” in the basic definition? Just because we can assign a single number to the temperature of an object that is in thermal equilibrium does not mean that every atom of the material is moving with the same energy because of the nature of averaging. If the average height of everyone in the room is 5 feet 9 inches, this does not imply that everyone in the room is 5 feet 9 inches tall. Some people will be 6 feet tall while others will be 5 feet 6 inches tall. The average of a set of a values only gives us a general idea of the group as a whole and does not tell us about any individual in the group. In the same way, the atoms in a material are all moving at different speeds and with different energies, even when the material has a constant and uniform temperature. Some of the atoms are moving faster than the speed corresponding to the material’s temperature and some of the atoms are moving slower. A few of the atoms are moving much faster than what is implied by the temperature.
Returning to the example of people in a room, if you had several hundred people in a room, measured everyone’s height, and plotted a distribution of the number of people versus height, you would most likely find a curve that is somewhat smooth and shaped like a bell. Many people will have a height that is very close to the average height and only a few people will have a height that is very different from the average height. The average height is therefore a good indication of the approximate height of most of the people in the room. The more people there are in the room, the more smooth and bell-like our height distribution will be. Similarly, the temperature of a material tells us the approximate location of the smooth distribution of the atomic kinetic energies.
Why are the atoms of a material moving with different energies? It is because thermal motion is random motion. When randomness is involved, many outcomes will result despite underlying laws making certain outcomes more likely. For instance, if you take two six-sided dice and roll them, you could get any number between 2 and 12. The most likely roll is a 7 because there are so many different ways to combine the numbers 1 through 6 of one die with the numbers 1 through 6 of the other die and end up with the total 7. If you rolled these dice a thousand times, you would indeed find that you roll the number 7 most often. But you will still roll all the other possible numbers eventually because the rolling of dice is a random process.
When a system of particles has had the chance to settle into thermal equilibrium, the distribution of its particles’ energies spread out over what is called a “thermal distribution”. In a rough sense, the temperature of a system represents the center of its thermal distribution of particle energies. The existence of a broad thermal distribution of energies has significant implications. If we take the half of the particles in the system with the most energy and throw them away; in essence, chopping off the top half of the thermal distribution; then the midpoint of the distribution will be lower. Therefore, the temperature of the system will be decreased. This process is known as “evaporative cooling”. For example, the water vapor coming out of your hot tea contains the hotter particles, so that the water that is left behind is colder on average.
Another important implication is that even if the temperature of a system is below some critical threshold, there will still be some particles that are energetic enough to surmount the threshold. For instance, in a semiconductor, the outermost electron states have a base energy that is too low to be in the conduction band. The conduction band is the state in which electrons become free and can form electrical currents. Despite the base energy being too low, many outer electrons in the semiconductor indeed have enough energy to jump into the conduction band and form an electrical current. The hotter a semiconductor gets, the more its thermal distribution of outer electrons spreads out, and the more electrons there are in the conduction band to form a current.