In the US, where this kind of work is usually carried out by state-sponsored actors, the agencies in question train their own - the CIA for example takes a look at ( mostly ) young people from high quality "general" sources such as Ivy League schools and entices candidates who seem to be of quality to apply, and train them over the course of a career.
Again as an example, the CIA has a number of different divisions - technology, logistics, field operations, and administration for example, and after basic orientation and training in fieldcraft, history of espionage and related topics ( cryptology, etc. ) the new employee starts down a career track in one of the divisions, receiving more advanced training as they progress in their careers. Logistics and support is huge - not everybody is dreaming up field ops or is actually in the field servicing dead drops, turning key foreign assets, or otherwise furthering the agency's agenda.
In the US, there are several different agencies with often-overlaping responsibilities - CIA is responsible for gathering information on all current and potential enemies of the US and building up actionable intelligence and assets to forward US diplomacy. The NSA has vaguely the same overall charter but has technology ( comms, codes, computers and so on ) as its main purview. DHS and the FBI operate as the CIA does but ( mostly ) with a more domestic charter, from within the country itself. Each branch of the US military has its own intelligence agency and focus on tactical or strategic operations. All of these agencies share information to some extent, and use a hugely varying set of collections methods such as the internet and other open-source collection, human eyes and ears, satellite reconnaissance, electronic surveillance of comms, pattern analysis of behavior and traffic, and many more.
Agencies and their people train constantly, and ( try to ) adapt to a changing world. Drones, non-state actors, corporate concerns blending with national agendas, and an increased reliance on vulnerable technologies continues to change how people do this kind of work.
Some of the work agencies do is very tactical - let's get this person to defect, let's get the plans for that new fighter jet, let's see what their building over here. The work can also be strategic - How would this country likely respond to an oil shortage, how is this other region most vulnerable, in case the actors here decide to take a poke at our interests?