What happens if you don't get tenure? I've heard different takes on what the convention is when an Assistant or Associate Professor does not achieve tenure. Can you just remain at your existing position and continue to teach and conduct research? Can you reapply for tenure again later? Is it more conventional to leave the institution for another tenure-track position at another institution?

This is in regard to US universities, but perhaps an answer articulating what is common in different countries is best.
In my experience (in math, in the US), no you cannot remain in your current position (for long).  While tenure is historically a means of protection for faculty from political forces, and thus a tool to provide academic freedom, pre-tenure periods often function as a sort of long-term provisional hiring period to make sure you're right for the university/department and getting tenure is sort of stamp of certification of your worth to the department and university.  So if you fail to get tenure, the reason is typically because someone decides you're not performing well enough in your current position.

That said, the university will typically give you another year in your current position which gives you time to look for jobs elsewhere.  People who don't get tenure usually move somewhere else, or have trouble getting another job.

Note: Sometimes people go up for tenure early (before the specified date in your contract).  I don't know what the standards are for consequences of not getting tenure then--when I've seen people go up early, they got tenure.