Because of dynamics called room modes.
Room modes are the collection of resonances that exist in a room when the room is excited by an acoustic source such as a loudspeaker. (...) each frequency being related to one or more of the room's dimension's or a divisor thereof.
To keep things simple, we will assume the room has 6 parallel walls (right prism or cube) and will just focus on one type of room mode: axial (because it's the simplest, and it is predominant over other modes). The calculations of the room modes of more complex shapes can get very complex, very fast.
The relevant parameters are the dimensions and shape of the room, and the wavelength of the sound. When the wavelength of the sound and the dimensions of the room coincide, there will be resonance. Similar to how a string will resonate to specific frequencies depending on its length (and tension, and materials, etc).
To make a room resonate:
Measure one dimension of the room: either height, length, or width. For the formula we are using we will measure it in meters.
Find the frequency that has a wavelength that is double the length of one of the three dimensions of your room. It's easier than it sounds, just use this formula:
Frequency = 1/2 x 343 m/s / the dimension of the room that you just measured
Where 343 m/s is the speed of sound in meters per second (an approximation, since it is not constant and depends on many factors) If you want to use other length unit, you can convert the speed of sound to your unit of choice, and use that unit in the measurement of the room and calculations.
Playback (or sing, if it's within your vocal range) that frequency inside that room.
For example, suppose there is a distance of 4 meters between the walls of your bedroom. The frequency we want would be 1/2 x 343 m/s / 4m = 42 Hz (that's between a E and an F).
Smaller rooms resonate to higher frequencies. That's why you noticed this in the bathroom using your voice, since a small room might have a room mode in the frequency range of the human voice. With one meter between walls: 1/2 x 343 m/s / 1 m = 171.5 Hz (very close to an F).
A given room also has higher resonating frequencies. If 42 Hz is a resonating frequency of your bedroom: then 42 Hz * 2 = 84 Hz, 42 Hz * 3 = 126 Hz and so on also are resonating frequencies of the room.1 Because the lower resonating frequencies of a room are usually very low, these might be easier to make resonate.
- Actually, waves which “bounces” against perpendicular walls can also resonate, but the formula which corresponds to them is slightly more complicated. If l, w and h are the length, width and height of a room (in metres), and for any integers (whole numbers) n, p and q, the frequency F given by the following formula resonates:
F = 1/2 * 343 m/s * square_root ( n^2 / l^2 + p^2 / w^2 + q^2 / h^2 ).