I don't think that any of the previous answers is 100% right.
1. It's easy to determine an index shifter. It will have distinct detents that you can feel as you work it through it's motions. You can feeld the detents even if it's not connected to a derailleur.
2. Friction shifters will work with any derailleur. I suppose itls possible to find a shifter that doesn't have the travel to operate some derailleur, but I've never encountered that.
3. Index shifting means the shifter has detents that pull exactly the right amount of cable to move the derailleur over 1 cog space. For that to work everything (shifter, derailleur, cable housing, cassette) has to match. Some components match across brands and some don't. Some Sram shifters will index a Shimano derailleur and some won't. In addition to the above, the cassette spacing of different numbers of rear cogs has changed so your shifter has to match the number of cogs on your cassette.