I would be interested to know what your definition of Junk DNA is. Are you referring to a potential coding sequence with no known gene assigned? A sequence inserted into a gene with no known /obvious function ? A sequence in a gene that is subsequently spliced out or does not encode part of the protein ? We can only presume something is junk because we cannot assign a gene or function to it, which in turn is usually based upon previous knowledge. There may as yet be unassigned ancient retroviral genes inserted into our genetic makeup for which we have no current knowledge but which have contributed to our evolution in some way. Likewise we may have lost functional activity of some sequences but retained part of the DNA.
There are many small peptides eg defensins which 20yrs ago would have not had a known function or activity and are encoded in very small genes. Si RNA is an example of nucleic acid sequences which in the past might have been assumed to be breakdown products or have no functionality but may have important regulatory roles
As far as assigning functions go, generally homology searches, conserved amino acid structural motifs are starting points. computer modelling of potential protein structures and possible ligand binding modelling etc. A comparison with known phylogenetic trees may give some indication of current or previous function.