Planning to travel from Germany through several other countries eastward on a sleeper train, I wonder what am I expected to encounter and how am I expected to dress? The tickets say 4 beds per compartment. As I guess the compartments don't have a place to change, is everyone expected to sleep in their street clothes? Hiking through the town all day then taking off the shoes in a small compartment might also cause unpleasant smells. Are there any places to change / wash ourselves, or are passengers expected to find someplace to shower before boarding the train?
This is what the compartment should more or less look like (pic from Wikipedia):
As you guessed, there is no changing room or something similar. A pillow and sheet like you see in the picture are provided.
There is some variation, but most people will sleep in comfortable street clothes or close to that. Usually at the end of the coach there are toilets and a washstand. The washstand is probably the closest you will get to a changing room. You can use it to clean your face, to shave, brush your teeth and eventually do a quick cat wash. No full shower. That you should get somewhere else. If you decide on the cat wash try to leave the washstand as you found it instead of flooded. There might be shower facilities in major stations (Gare d'Austerlitz in Paris has some for instance, I'm not sure about German stations).
If you expect smelly shoes/feet the best option is probably to air your feet and footwear before boarding the train. If you can carry some light sandals to replace your heavy hiking boots, that would be an option. Putting your smelly shoes in plastic bag and knotting it well closed will also make a huge difference.
Another thing to be aware of if you want to be considerate towards the other passengers (and it sounds you are, thank you) is to avoid noise for people that are already sleeping when you board the train or are still sleeping when you leave the train. If you leave very early make sure that all your luggage is easily retrievable with at minimum on noise. Postpone putting on your shoes until you are outside the compartment, in the corridor. Places to store luggage are under the lower beds (rather narrow space), above the door (surprisingly large, perfect for bulky items) and behind that little stair. Avoid putting anything behind the stair when boarding in the middle of the night because putting something there is always noisy. I often put a small bag simply next to me in the bed, but this depends largely on the size of the bag and your own size.
My experience on French sleeper trains is that people get changed lying down on their bunk. Those who require extra privacy will slide into the sleeping blanket before removing their clothes. The top bunk will also guarantee you extra privacy since it's only visible by the adjacent bunk and not by the ones below.
There is no dress code for sleeper trains. Some people sleep in their normal clothes. I've seen soldiers sleep in their uniforms, and women changing to sleep in their night gowns. My experience is that nobody really cares what you wear. All in all you should pick clothes which are comfortable for you. In terms of temperature, keep a jumper close to you in case you are cold. Consider that the blanket might be made of synthetic material. If that's the case it'll be warm, maybe even too warm in certain trains.
You are not expected to shower before boarding. Nevertheless, smelly travellers, and their smelly shoes/clothes, can cause discomfort to others in the confined space that is the sleeper compartment. My advice is that you find a place to get cleaned/remove body odour before getting to sleep in the compartment. Consider carrying wet wipes which you can use to clean up in the train toilet/washroom. Some stations have showers so you could consider using those. Nobody forces you to go straight to the compartment once on the train. If you are afraid of having smelly shoes, you can take them off outside the compartment and hang around in the train corridor for a while waiting for part of the smell to fade away.
If you have particular sleeping needs, pack your gear for sleeping. Earplugs, sleeping mask, pillow, etc. Plugs and pillow are usually provided but you might want to carry your own or need extras. Your fellow travellers can be snoring bears, crying babies, sleep-talking behemoths, as well as normal nice people. Say hello when you meet, tell them where you'll be stopping so that they expect the noise when you wake up, be friendly and smile.
The compartment can be locked from the inside. You'll have to trust your fellow travellers to always lock it at night, and you should probably do the same. You should also keep your valuables with you at all times.
Finally, don't worry too much about the journey. It usually goes very fast: you get in the train, store away your luggage, get changed, and lie down to sleep. The time at which sleeper trains leave usually ensures that you'll be tired enough once you board. In my experience you'll sleep like a log between 00:00 and 05:00. During this period the train doesn't stop very often and rolls at a comfortable cruise speed. After 05:00 the train usually accelerates and will begin serving passenger stations (the French SNCF says no stops between 00:00 and 05:30 for example). The deceleration of a stopping train is usually what wakes me up.
If you're travelling in a small group (e.g. a couple), you can also get a compartment to yourselves for a fairly small extra charge - the Jan Kiepura from Cologne to Warsaw has compartments from 1 to 3 berths as well as the 4 or 6 berth couchettes - or if you're feeling flush, also has 1 and 2 berth deluxe compartments with a private shower and toilet.
Edit: It looks like the German CNL trains also have the same combinations - look for Schlafwagen (sleeping car)