In the case of 2x20's. These are often referred to as Steady States and the goal is to work at your Lactate threshold. (for simplicity's sake about the pace you can hold in a one hour TT.) Typically you would warm up, do the first 20, recover 5 to 10 minutes, and then do the second 20.
Shorter intervals usually are done as hard as you can hold for the prescribed time. Sometimes they're done with a lot of rest between the intervals, and sometimes they're done on short rest, to work on your ability to recover between efforts.