There are 5 main types of bans/suspensions and only one of them is of indefinite length. Some are manual and some are automatic.
Review Suspension (formerly known as Review Ban) - this is either manual by a moderator or automatic when you fail enough audits. This type of suspension prevents you from participating in the review queues, but your other interactions with the site are unaffected.
The duration of the suspension given by moderator can be set manually and they have their own criteria for how long to set a suspension. But the automatic suspension always scales based on your last review suspension length and time since your suspension ended (less than 30 days, double your last suspension length; more than 30 days, the length is half).
Flag Ban - a completely automatic process that limits your ability to flag posts if you had enough declined in the previous 7 days.
Suggested Edit Ban - another automatic ban that prevents you from suggesting edits to posts. This is based on the number of rejected edits and accepted edits over the previous 7 days. There's also rate limiting that will essentially impose a very short duration "ban" to prevent someone from spamming too many suggested edits.
Moderators can also levy a manual ban to block a specific user from suggesting edits. These are rare, since moderators can levy other suspensions.
Post Ban - another wholly automatic ban that prevents you from posting new questions or answers (there are separate question bans and answer bans). This is based on a secret algorithm that measures how well-received your past posts have been. This is the only indefinite ban that exists on the site (although you are usually given another attempt to ask every 6 months to see if your asking/answering skills have improved).
Account Suspension - the last type of ban is 100% manual and reserved for only serious infractions of the rules. These are always accompanied by a message from the moderators (both to your notifications inbox as well as your email). Basically, your ability to interact with the site is removed and your reputation is temporarily set to 1.
The length of the suspension is issued in days and can last for up to 1 year.
A more serious version of the account suspension exists that will suspend you from the entire Stack Exchange network and/or for periods of longer than 1 year, but that can only be levied by a Stack Exchange Community Manager (i.e., the Community Management Team, which are made up of employees of Stack Overflow).
There are also IP-level bans throughout the site, and other rate limiting to slow users down.