I'm curious about plain simple syrup and simple syrup with other ingredients. For instance, cardamon simply syrup. Do other ingredients make a difference?
The key factor in syrup's shelf life is the water activity in the syrup, rather than the ingredients used to make it. Generally, the water is all 'bound up' with dissolved sugar so microorganisms can't use it to grow, but the lighter the syrup, the more available water it will have.
In my experience, simple syrup is usually kept refrigerated except for small portions that will be used within a day or two.
For a chart of water activity (aW) of related foods, check here: Water Activity Table
I've done a lot of reading on this subject - as well as quite a bit of my own experimenting - and this is what I've concluded:
A highly concentrated simple syrup produced in a sterile environment and stored in sterile containers (with sterile caps) has a shelf life of at least a month as long as the containers remain unopened. I recommend glass bottles with phenolic or otherwise lined caps.
I use a 2 to 1 ratio (2 sugar, 1 water) and simmer my solution for at least 15 mins to reduce it and to allow my other ingredients to absorb. I primarily use whole vanilla beans and various spices.
I do recommend refrigeration after the bottles have been opened to prevent any microbes from sneaking in.
Use best kitchen practices and keep everything clean and your syrups will likely be fine.
There's a few things to consider, but let's start with a general term to encapsulate the safety issue, call it "bacterial potential". That is, how numerous would bacteria be in the solution before it's stored, and how much sugar is available to fuel whatever bacteria are present.
I start off a basic simple syrups with a rolling boil to kill the bacteria and make the sugar dissolve quicker. This method generally results in a syrup that's shelf stable for at least a month, so long as the bottle in which it's stored is sanitized ahead of time. Very low "bacterial potential".
I haven't experimented much with ingredients beyond sugar & water, but depending on the additional ingredients, I would strongly consider forgoing the boil. You can create a simple syrup at room temperature. Here's a good article from SeriousDrinks that outlines the process. The "bacterial potential" when you haven't boiled the solution is going to be higher, and unless you had a very good reason not to, I would refrigerate the syrup and discard it after no more than a month.
It's called 'simple' for a reason - there's not much stopping you from whipping some up on-demand.
Simple syrup should be used immediately. That which is left over should be poured down the drain. Storing it, even by refrigeration, is asking for trouble. If you don't use that much of it, or don't use it very often; may I suggest that you purchase a bottle of agave syrup and use it instead, storing it in accordance with the instructions on the bottle?