If you salvage a weapon with a gem it will return the gem to your inventory. If you don't want to salvage the weapon you can go to the gem vendor and unsocket the gem you want to take out- but it will cost gold.
Once you clear the dungeon for the trickshot aspect, the aspect will be added to your codex and then you can use it for as long as you wish- there is no limit as to many times you can imprint it. The caveat to that is that the codex version of the aspect is the lowest ranked version of the aspect. There will be legendary drops with aspects with higher ratings- those are the ones you want to use carefully, as they can be either kept on the item they were originally on, OR be extracted and imprinted on another item of your choice, but you can only do this once per aspect. After that you cannot transfer it anymore.
In simplest terms- in the case of trickshot, I'd recommend clearing the dungeon that has it so you can add it to your codex, then imprinting it on whatever you wish at the occultist. The codex version will let your split arrows do 10% of the base damage of your penetrating shot. Then be on the lookout for legendary drops that have this same aspect- as this aspect can have the split arrow damage range anywhere from 10-25% (20-50% if it is on a bow, and 15-37% if on an amulet). So for instance you can put the codex aspect at 10% damage on your bow, which will give you the 2x boost so it'll actually be 20%. In the wild you may find a pair of gloves that has the penetrating shot aspect with 20% damage, but you can extract that aspect and put it on your bow to have your side arrows do 40% damage because you will get the 2x boost.
This website has some good info on aspects for each class, where to find them, and tips on gambling at the vendor of curiosities so you can spend your obols to try to get the legendary aspect you want.
https://diablo4.life/tools/gambling