A simple question that hides a mountain of complexity. 
There are 2 pieces of information you need to figure out. 1) The main or central note of the melody. This is the tonic note of the tune, and gives you the letter name of the key. 2) The scale or mode that is constructed around that tonic note.
Here is a mechanical discovery procedure or heuristic that works for some (but definitely not all) ITM tunes.
The last strong beat of a tune (or A Part, B Part, etc.) often falls on the tonic note, because ITM tunes usually want to resolve to the tonic. This is especially true when the last strong beat is a quarter note (crotchet) or longer. For a jig or reel, the last strong beat is the second beat of the last measure, when counting in 2.
Once you’ve identified the tonic = key note, do an inventory of the notes of the tune, and line them up in scale order. Then, starting on the tonic note, play those scale notes up and down, and match the result (by ear or by examination) to one the possible modes for that key. The tonic + mode gives you the “key” identification you’re looking for.
For example: The Congress Reel. The last 2 measures are |cBcd eged|cABG A4|. The last strong beat is A. That’s the tonic. Line up the scale notes: G A B c d e f# g a. Playing up or down from A or a, that matches a Dorian scale. So the “key” is A Dorian.
Another example: The Kesh Jig. The last 2 measures are |g^fg aga|bg^f g3|. The last strong beat is g. That’s the tonic. Line up the scale notes: G A B d e f# g a b. Playing up or down from G or g matches either the Major (Ionian) or Lydian mode. Why the ambiguity? Because the c note is missing! The scale is hexatonic (only 6 notes) or gapped. So how do you decide? Well, if you think inserting a c-nat would sound better, then it’s probably Major. If you think that inserting a c# would sound better, then it’s probably Lydian. In fact, in ITM the Lydian mode is pretty rare, so G Major is almost certainly the right choice here.
There are many common tunes where this heuristic works: Sally Gardens, Otter’s Holt, Silver Spire, Maid Behind the Bar, Maids of Mt. Kisco, etc. Also many tunes where the heuristic fails: The Butterfly, McMahon’s, Humours of Tulla, etc. But after a while you can learn to recognize a delayed or false cadence at the end of a tune or part, and still identify the tonic.
In fact, after a while you learn to recognize the tonic/key/mode without doing these sorts of explicit calculations at all.
I know there are many holes in this little trick. But to fill them would require pages, and I’ve got to get some sleep to play for a Civil War Ball re-enactment tomorrow. Gnight …