Key and tonic are highly contextual in all music, so if a melody line is all one has to go on and that line is ambiguous in what it implies (it does not contain enough information to narrow down all possibilities to one answer), it may not always be possible to arrive at one answer with a high degree of certainty without additional information.
Of course, knowing that we are talking about North Indian classical music gives us quite a bit of context. We know that this music is almost always accompanied by a drone on the shadaj, we know that the shadaj forms the basis for a raga, which defines a melodic construct, and we know that instruments like the tabla and tanpura are tuned to the shadaj.
Harmonium, as you mention, can be used to play melody, but can also be used to provide a drone (some harmoniums are provided with a drone stop to make this easier).
So, to the point of figuring out what the shadaj is from a subset of all of this contextual information, the job is easy if any drone is present OR if the tabla can be heard. If, however, all we have is the melody alone (either in audio or transcribed form), then we need to reverse-engineer the sequence described above. Since the shadaj informs the raga and the raga informs the melody, with enough melodic information we should be able to ascertain the raga in use, and in doing so we determine the shadaj.
Ragas are different from "Western" scales in that the set of notes, their tunings, and the melodic embellishments used on those notes are all defined by the raga in use. So, we have all of those factors to go by when narrowing down the possibilities of which raga, and therefore shadaj, is associated with a melody. This also means that having the shadaj missing from the melody that is being sung should not be such a great burden with all of the other information to be used to ascertain the raga.
In terms of actually making this determination of which raga is in use, the process should not be so different for an expert of Indian classical music as it is for a Western classical or jazz musician to do the same for a scale or key. From a cognitive perspective (for either style), the musician that hears a melody associates it with his or her existing knowledge and training so he or she has an expectation of where the melody will go and what notes will be used. After this guess is made, a few more seconds of listening can confirm or refute it, and if correct, the determination has been made within a margin of error provided by the extent of musical context present.
The untrained ear can do the same process logically, of course, though at a much slower pace, and with a higher rate of error. (This applies to any algorithmic or computerized methods as well.) The sheer number of ragas makes this a bit of a tall order for Indian classical music compared to common practice Western classical music, but if you only need to find out the shadaj, you can group your possible ragas by shadaj to make your process of elimination a bit more manageable.
Disclaimer: I am not formally trained in Indian classical music; please let me know if I have gotten something wrong.