I suppose there's no straight answer to this, but what ideas come to mind for determining how much each programmer would get for participation in a collaborative project if it were to be sold?
I think there is only one good answer: What you agreed upon before you started the work. If such things are clear from the start and people know what to expect there will be much less bad blood then if you make up some arbitrary rules when the product launches and you suddenly find out you have a pile of money to divide.
I think there is only one good answer: the same share. Of course you can try to differentiate it by the effort that each programmer has put into creating the application, by the number of hours, by their skills and experience, etc. But you won't be able to measure it reliably and you won't be able to define such rules that all team members will be happy with them. So try to get guys who have similar experience and will spend similar amount of time of the project. If some of them decide to quit before the project is finished, they just don't get their share.
It is basically depend on task(s) complexity, assigned to each developers.
Each task has difference or similarity in terms of completion time and complexity. Thus, you may need to have a complexity level determined for each task with some rough hours of expected completion. That will guide you over the process to determine the input of each project participant.
Who may determine the complexity level? - Well there should be at least Team Lead and PM in that group who defines task complexity and timing.
I think it's important to define the roles and percentages before the project starts. Since I don't know what those roles are on the project, I can only make up my own here.
Scenario 1: Everyone puts in the same amount of effort and has the same skill level.
Answer: Divide the share equally.
Scenario 2: Some developers don't spend all of their time on the project, and some developers perform easy/simple tasks:
Team Lead: n%
Full-time developers: n%
Part-time developers: n minus x%
Part-time QA: n minus y%
Part-time documentation writers: n minus z%
This could continue for all of the different scenarios available. You (and/or the team) will need to make your decisions as to what n, x, y, and z represent. The important part is to define all of this up front, and agree on relative percentages based on the role.