I heard that there was a twitter bot which automatically posted questions and asked for answers for specific questions on every site. How do they work? Is there an algorithm for doing this or is it purely random? I know that it doesn't tweet closed questions, but that's it.
Looking at the Server Fault and Super User Twitter streams, it looks like each account is set up to automatically tweet a new status every 3 hours. According to this answer by Nick Craver there is a "hotness" algorithm based on views over a certain period of time. (This is probably similar to the algorithm that populates the recently active questions page.) Also according to that same answer, questions now have to have a score >= 1 in order to be tweeted. Another check in the algorithm (again according to Nick) is to avoid tweeting questions that have close votes on them, unless they have a bounty.
If you look at the list of all Stack Exchange sites you can see which ones have Twitter accounts by looking for the "twitter" link that appears underneath the number of questions on the site.