So how much do tables usually cost? Around $15-$35, something like that, although it depends on the convention. One day cons could cost less, while 3 days cons probably cost more.
What about signing up? well of course you can sign up for a table on the convention's website, when you do it though will either guarantee you a spot, or you just won't get one :(
How many months in advance? well if you really want a table for a con watch the website around 1 or 2 months in advance. Usually conventions put up the registration around 1 month before the actual convention, of course it depends.
Also be careful with really popular conventions like Otakon because you'll need some fast fingers to get a table there.
If you don't get the table you can always try asking someone who did to share with you although I wouldn't recommend doing that with a perfect stranger..