The answer is relatively simple, the preferred way is using BBT (Block Brake Timer) then you only need 2 sensors. But sometimes you can get by with one and sometimes you need more than 3. And then you can have special reasons for more sensors.
More about BBT
In the pictures: S1, S2 and S3 are sensors, the plus and minus sides of Rocrail blocks and direction of travel are shown. The sensors are placed about 20 cm (for H0) from the ends of the block. Experiment a little with your trains, as this is also dependent on the speed of the train in that block.
More about Routes in blocks
As stated before you can get good results with 2 sensors per block, depending on the direction of the train S1/S2 are an "enter" or an "in" sensor. There are several types of sensors that can be used to record an event in a block, they all have their pros and cons.
More about Sensors
More about Sensor definitions
Where a train stops in main line blocks is not that important, as long as the train stops completely in that block. Optionally on mainline blocks you can use only one sensor. Assuming travel can occur in either direction the sensor needs to be placed in the middle. The physical sensor generates the enter-event and starts a timer which generates the in-event after its expiration.
Usually you set a timer to control when the train stops.
If you do not want to use BBT in station blocks you have the capability of stopping trains differently. Short trains should stop at different places than long trains. The question then becomes how many different routes (with their sensors) will you need in the block concerned. This is of-course an option for all blocks, but mainly in station blocks you can use more than two sensors, sometimes you can have 3 or more sensors, the third sensor is often a “pre2in”. Short trains make sure that they continue to “pre2in”. With three sensors, "enter", "pre2in" and "in", the train decelerates to V_mid at enter and to V_min at pre2in. In blocks equipped with two sensors (enter and in) the "pre2in" event can be simulated using "enter2pre" instead of "enter". The physical sensor generates the enter-event and starts a timer which generates the pre2in-event after its expiration. The train decelerates to V_mid at enter and if the timer is elapsed (pre2in-event) it decelerates to V_min. The sensors need to be placed so that the required stopping places can be obtained. Some experimenting will probably be necessary.
More about Sensors in Blocks
The pre2in triggers the slowdown of the locomotives. All locomotives will stop quickly after arriving at in. This leads to the very exact stopping point. The pre2in allows shorter trains an earlier stopping point: To achieve this the respective locomotives are set to “stop at pre2in” in the locomotives properties. Now for these locomotives the pre2in has the function of the in-sensor. You can also create routes in the block, here is an example for short and long trains.
As you can see the different route names (Block-short/long) use the same three sensors but use a different sensor event.
Other reasons to add sensors to a block are often "action" related: e.g. sound a bell on a loco, turn on crossing lights, turn lights on in station, etc.
More about Actions