What affects stealth?
I will answer this question based upon my own ingame experience:
Does being in shadow or nighttime matter?
No difference observed.
The handbook says hiding in foliage makes you less visible. Do you actually need to keep leaves/branches/stalks in between you and the enemy, or can you just find a big fern and crouch near it?
As long as the fern is in the line of sight you can crouch near it. To block view from all lines of sight you have to crouch inside the fern.
There seem to be a lot of boxes, crates, low fences, and other cover which is almost high enough to cover you, except you can just see over it, even crouched. Is this considered hidden or not?
As long as the box is about 1/2 of a metre high (about 1/4 of your standing view height) you count as hidden. Example: An enemy could clearly see my head (and I could see the enemy as a result) from behind a box while the enemy looked directly at me from about a metre away, yet I were completely ignored. I was not wearing the uniform at that point.
Does being on a different level (1 floor up or down) from an enemy affect your chances to be seen?
Yes it will, but only when it is a significant height difference (e.g. a small cliff of about 20 metres), as enemies normally only look at head height and the normal field of view. Be advised that enemies will look up if they notice shots coming from your direction (even if the shots are silenced).
How does an enemy's alerted state affect their vision and ability to spot you? Are they more likely to look up and down or do they just look at the spot where they last thought you were? They seem more likely to see you in foliage as well.
Their attention is heightened in an alert state, resulting in higher seeing (higher range and see you better in cover) and hearing. They will advance to the last known position of you. If you back off without being seen or hide in really thick ferns, they will lose interest after a while. Enemies will start to alter their patrol patterns when they go back when interest is lost. Be advised that enemies may throw molotovs or grenades at your last known (or guessed) position.
How do enemies detect by movement sound (when you are not in their vision)?
Walking will lessen the sound you make compared to running. Crouching will also lessen the sound you make compared to walking. The skill "Ninja Step" will reduce sound produced by running and walking. To gain access to this skill you will need to liberate 2 outposts without beeing detected. Also enemies will notice when you shoot near them, even if it is with a silenced gun. I don't know wether it is due to the sound of the bullet hitting the area around them or simply because they noticed a bullet flying next to their head, as I was ~200 metres away with a silenced sniper, when this happened.
Does difficulty level affect stealth?
I would guess yes, in the way that they will at the very least stay in an alert state a while longer. Being able to spot and hear you better would be logical, seeing as stealth is a major part of the game.
But again, this is just a guess as I never changed the difficulty (sorry).
Anything else affect your likelihood of getting spotted?
If enemies discover corpses they will go into an alert state.
Hope I was able to help