Checking for singularity of matrix

Numerically, this question is a bit ill-defined, because roundoff errors make it hard to distinguish between a matrix that is exactly singular and a matrix that is nearly singular. Moreover, as a practical matter it is rarely a good idea to try to make this distinction — matrices that are nearly singular are in many ways just as “bad” as matrices that are singular.

If you find yourself solving a lot of systems that are nearly singular, that it is a good sign that you need to re-think what you are doing. (e.g. perhaps you need some regularization in your equations)

Where are these matrices coming from? Why are they sometimes singular or nearly so?