The Forking processes creates Children in a tree-like manner.Consider each fork to be the different layers of a Binary Tree.When you dont issue a fork() u have a process tree of only a root node.When u issue a single fork() then u have a binary tree with two levels now , the first level will the contain the parent process , the second level will contain two processes - the parent and the child process.
When u want to find out the number of processes u have at hand just proceed building the binary/process tree and see how many nodes are there at the last level, the last level is nothing but the current state of the process/tree.Wait function makes your parent wait for the child process to finish executing.In applications where u do not want a zombie process you need to issue a wait or else these zombie processes will keep hogging the system... link.
Remember that wait is also useful when you always want the parent to finish after the child . Forking doesnt always give the same output , the order is jumbled , thus to get the same output always , use wait(). To wait on a particular child process , use wait(pid) where the pid is the pid of a specific child and that pid can be obtained by getpid inside the child process's space.