If you captured, fainted, or frightened off a wild Pokemon, its spawner will create a new one after a certain wait time, which is typically some preset value between 2-5 minutes. You can't speed this up by leaving and returning or by changing the time of day. If you stick around and wait, the Pokemon may even respawn right before your eyes, though sometimes you need to give it space by walking a few paces away first. This map shows you the respawn timer for each spawner. Note that some spawners pick from a pool of multiple Pokemon, so it might respawn a different species than the one you originally encountered.
If the wild Pokemon disappeared because it got separated from its home area and couldn't find a path back, it should reappear at its spawn point immediately after. Again, you might need to give it some space. It should stay the same Pokemon, rather than spawning an entirely new one, so this is more like teleporting.
If a wild Pokemon is present, you can instantly "reroll" it by fast traveling, changing the time of day (at a bench, bed, or naturally), entering/exiting buildings that load a new area, blacking out, or resetting the game. This effectively makes the spawner create a new Pokemon, which could have different attributes such as species, gender, shininess, and stats. By repeatedly rerolling for new spawns, players can try to get Pokemon with particular desired features. So if you're looking for something specific, make sure you don't knock out the ones you don't want, because you won't have to wait for the respawn timer if you leave them healthy.
Shiny Pokemon are exceptions to this. The game will preserve up to 10 shiny Pokemon, making them immune to getting rerolled. This means that you won't immediately lose a shiny by accident if you continue to reload the area after it was initially spawned. It may not appear if the environmental conditions changed (e.g., a Pokemon who only spawns during daytime was generated as a shiny and you changed the time to night), but it should reappear if you return to its preferred conditions.
After 10 shinies have been saved, generating a new shiny will erase the oldest uncaptured shiny from the world. For example, if you generate 1 shiny Weedle, then 9 shiny Magikarp, then 1 shiny Pikachu, the game will let the shiny Weedle despawn and hold onto 9 shiny Magikarp and 1 shiny Pikachu. For this reason, you can still risk losing a shiny by not catching it right away, especially as you may be unaware of existing wild shinies in your game.
Credit to @Sibuna_Switch for information about shiny Pokemon.