Elements heavier than iron are produced mainly by neutron-capture inside stars, although there are other more minor contributors (cosmic ray spallation, radioactive decay).
Neutron capture can occur rapidly (the r-process) and occurs mostly inside supernova explosions (though other mechanisms such as merging neutron stars have been mooted). The free neutrons are created by electron capture in the final moments of core collapse. At the same time this can lead to the build up of neutron-rich nuclei and the decay products of these lead to many of the chemical elements heavier than iron once they are ejected into the interstellar medium during the supernova explosion. The r-process is almost exclusively responsible for elements heavier than lead and contributes to the abundances of many elements between iron and lead.
However, many (50%) of the chemical elements heavier than iron are also produced by slow neutron capture; the so-called s-process. The free neutrons for these neutron-capture events come from alpha particle reactions with carbon 13 (inside asymptotic giant branch [AGB] stars with masses of 1-8 solar masses) or neon 22 in giant stars above 10 solar masses. After a neutron capture, a neutron in the new nucleus may then beta decay, thus creating a nucleus with a higher mass number and proton number. A chain of such events can produce a range of heavy nuclei, starting with iron-peak nuclei as seeds. Examples of elements produced mainly in this way include Sr, Y, Rb, Ba, Pb and many others. Proof that this mechanism is effective is seen in the massive overabundances of such elements that are seen in the photospheres of AGB stars. A clincher is the presence of Technetium in the photospheres of some AGB stars, which has a short half life and therefore must have been produced in situ.
According to Pignatari et al. (2010), models suggests that the s-process in high mass stars (that will become supernovae) dominates the s-process production of elements with $A<90$, but for everything else up to and including Lead the s-process elements are mainly produced in modest sized AGB stars that never become supernovae. The processed material is simply expelled into the interstellar medium by mass loss during thermal pulsations during the AGB phase.