¿Piñata?
In emacs it can be done using the function `toggle-input-method' which has the default keybinding C-\ (which is Control \ ). For me that toggles to "latin-prefix" (which is from the customizable variable `default-input-method') and that input method seems to automatically combine a punctuation character with the next typed character.
So typing the ~ and then the letter N ends up with both becoming combined into the Ñ for PIÑATA, or ~ then n for the ñ in piñata. As simple as that. Also typing the apostrophe ' followed by a vowel such as e ends up making an é. Either way the punctuation mark or accent is underlined when initially typed and that indicates it will try to combine with the next typed character. Typing the same punctuation mark or accent instead will cancel that and simply leave the mark there, which enables having a tilde ~ or an apostrophe ' (which is also a single quote mark).
There's also C-x 8 RET (which is Control-x, 8, then the RETURN key) which allows for typing the name of a specific character, such as LATIN SMALL LETTER N WITH TILDE for ñ in piñata. Or for symbols like HORIZONTAL ELLIPSIS for the "…" character. Tab completion is a quick way to have the whole name gradually auto-typed. For example for "HORIZONTAL ELLIPSIS" just type using the TAB key: hori TAB e TAB.
On the other hand, the secret for typing accented characters on macOS with a U.S. keyboard involves the Option key. In general, hold the Option key, type a special key for the accent, then type the character for combining with the accent.
One way to find out the special keys in macOS is with System Preferences > Keyboard > Keyboard and then select the checkbox next to "Show keyboard and emoji viewers in menu bar". That will put a flag symbol on the righthand side of the menubar indicating the currently selected keyboard, and in it the "Show Keyboard Viewer" option. The Keyboard Viewer shows a miniature keyboard revealing what will be typed by a key. With that shown, hold the Option key and most of the keys on that viewer will change to other symbols. Also for the Shift key, or hold both the Shift and Option keys and see what happens. Some keys become orange in the Keyboard Viewer when the Option key is held, and when those are typed they provide a highlighted accent for combining with other characters.
The Keyboard Viewer is not necessary for using the accents, though It is handy for discovering the (orange) accent keys and other symbols.
According to the Keyboard Viewer the tilde ~ accent is from the n key:
hold the Option key and type the letter n, and then release the Option key. A highlighted ~ symbol will have appeared. Now type any character that is compatible with a ~ such as n or an o. It's just like using the Control key or Command key for keyboard shortcuts, but use the Option key instead.
For the ñ: hold Option then type n and release Option, then type n. Or for õ: hold Option then type n and release Option, then type o.
The upside-down exclamation mark is simpler, it's just Option 1 (the number one, not the exclamation mark). ¡Piñata!
Upside-down question mark is just Option ? (so it requires the shift key). ¿Piñata?
Option e gives a highlighted accent, then type a vowel to combine it, f.e. café. The other accent is Option ` (backtick, same key as tilde, under the esc key), as in "à la mode". The umlaut is Option u, for making the letters ü or ö or ï and so on. The circumflex is Option i, for making ô or î or ê and so on.
¡¿Piñata?!