Question one would be, if you have written the music already, then why do you need to know what key is in? What do you plan to do with this information?

Assuming it matters to you, the key centre means which of the 12 chormatic tones sounds the most stable and resolute in the harmonic and melodic context of a piece of music. There is not required to be a clear key centre, nor is this key centre required to remain fixed throughout and may vary between sections, or even more frequently. The modality is defined by the apparent function of the other notes played in that context, with the expected function in a given mode (e.g F# is an “in color tone” for C lydian but is a “blue note” in C minor). You could guess this by counting the occurrences of each note and assuming all the more commonly used ones are in key, and hence infer a mode/scale; Note that the harmonic and melodic minor scales have 7 modes too, so don’t rule those out either.

8 Likes