I don’t know how others are doing it, but here’s what’s worked for me… note that the following code was written to show just the parent categories (my edit form used categories perhaps a bit differently than most). Still, it should be easy to modify to work in the general case.
<select name="category[]" id="main_category" size="1">
<option value="">-- Select a Category --</option>
{exp:query sql="SELECT
c.cat_id,
c.cat_name,
p.selected
FROM
exp_categories AS c LEFT JOIN
(
SELECT cat_id, 'selected' AS selected FROM exp_category_posts WHERE entry_id='{entry_id}'
) AS p ON c.cat_id=p.cat_id
WHERE
c.parent_id='0' AND
c.group_id='3'
ORDER BY c.cat_order ASC;"}
<option value="{cat_id}" {if selected == "selected"}selected="selected"{/if}>{cat_name}</option>
{/exp:query}
</select>