The first thing that you need to do when wanting to set up signals for your layout is have some kind of “Signal Plan” for your model railroad. You must decide what you actually want to do. As an example, on mine, I have the railroad divided into blocks. These blocks are detected blocks so when a train is in them, a signal is sent to a computer program. (Block detection can be simplified by saying it is train detection.) Also, when a turnout is thrown or changes position, a signal is also sent to the computer program. Then I have signal boards that connect to my signals and will make the colors of the signals change as these different things happen. The signals are wired to the signal boards and are controlled by the computer program.
The first step in making a signal plan is to draw a track plan of your model railroad, then decide where you want to put your signals (as determined by a real railroad). Next, decide what is going to make the signals change. Either when a train is in a block, in an OS section (A block made up of turnouts, referred to as “On Switch” sections.), or when a turnout changes; or all of them together. Once you do that, you will have a better idea of how many signals you will need, how many sensors or controls will be needed for turnout positions, and how many blocks will be needed to detect your trains.
As to how long a block should be, it is up to the person building the layout and how much track they have on the mainline. The length of the trains that you run can usually help determine the length of the blocks. One desire is to be able to fit a complete train in a passing siding. Another is that the mainline can be divided up into a number of separate blocks if there is enough distance from one passing siding to the next. Some people make the length of their blocks one train length long, and some make them two train lengths long, and some make them shorter or longer. I run short trains on my layout, 6 to 8 cars with one locomotive and a caboose. My mainline blocks are at least one train length long, and usually not longer than two train lengths.
At this time it may be a good idea to decide if you are going to go “whole hog” or do something simpler with your signal system. An example of a signal plan is shown below. It shows where the rails are gaped, the blocks and their ID numbers, the turnouts and their ID numbers, and the signals with their ID numbers. When developing the plan, place the signals first according to the signal practices of the railroad you are modeling. Then you can indicate the gaps that are required to make it work. The logic that makes it all work is associated with the computer program that you choose.